Skip to content

Add inclusion and exclusion filter for log types in the Syslog Agent #711

@chombium

Description

@chombium

There are some use cases where some app owners might not need all types of logs: RTR, APP, STG etc. It would be nice if inclusion and exclusion filters could be added in order that the downstream consumers are not overloaded with unneeded data. This would also save some costs for outgoing network traffic for the operators.

As there already is a drain-data Syslog Drain URL parameter, the extension with exclude-log-types parameter is easy to implement. Theexclude-log-types parameter should only be taken into account when there is no data filtering by type, no drain-data or drain-type parameter is set or when the value of these parameters is logs. The values for the exclude-log-types should be lower case variants of the log types listed in the link above: app,rtr,stg,cell, etc. Multiple values for the log types should be possible to set: exclude-log-types=rtr,cell,stg

The validation and parsing of the data type is done in the getBindingType and the actual filtering sending or skipping log envelopes in the Write and sendsLogs functions. This should be extended to take the log type exclusion filter into account.

The inspection of log type for the log envelopes can be done with the source_type tag.

To check the logs and the source types, one can use the following command of the log-cache cli plugin:

 cf tail -n 10 -c logs --json <app_guid>|jq '.batch[].tags.source_type
"APP/PROC/WEB"
"APP/PROC/WEB"
"APP/PROC/WEB"
"APP/PROC/WEB"
"RTR"
"APP/PROC/WEB"
"APP/PROC/WEB"
"RTR"

The filtering of application logs might be a bit costly as it will involve string parsing. We should take the performance into account and decide if:

  • we should put the app logs filtering behind a feature flag, so that the cf operators explicitly are aware about the possible performance degradation and want to to have that
  • say that by definition the application logs cannot be filtered out, as the app developers would be most interested in them

Example setup usage:
exclude RTR and CELL logs:

cf cups -l https://my-syslog-server.com?exclude-log-types=rtr,cell

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Inbox

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions