opentelemetry-collector-contrib
opentelemetry-collector-contrib copied to clipboard
[processor/filter] Add the ability to filter SeverityNumber below a certain severity
Is your feature request related to a problem? Please describe. Commonly, you want to reduce the amount of logs that you are sending, and a common way to do this is to filter logs under a certain severity level (e.g. only log "info" level and higher). Currently, there is no way to do that.
Describe the solution you'd like
Add a min_sev
field to the logs portion of the filterprocessor
(and the filterlogs
package) in order to allow for filtering of log signals below min_sev
. Essentially, the filter would match any logs at or above the level specified by min_sev
.
Design Questions:
-
Should the configured severities be the aliases of the severity, or the numeric value of the severity? Should we somehow support both? (e.g. should info be the integer 9, or should it be the literal "INFO"?) (if we were to use strings, we would follow the table from the spec)
-
Should records with no severity (severity 0) match or not match if min_sev is specified with a value > 0?
Related issue: #9235 - This issue is mainly about getting parity with the attributes processor, which allows filtering on SeverityText, but SeverityText is less standard since it represents the source severity.
Pinging code owners: @boostchicken @pmm-sumo. See Adding Labels via Comments if you do not have permissions to add labels yourself.
Gave these questions some further thought; Here's my opinion:
- We should support at least using the aliases (using e.g. DEBUG, INFO, INFO2, case insensitive). As a user, there's no chance I'm remembering that INFO is 9 off the top of my head. I think initially just using the aliases is the way to go.
- Records with no severity should not match if the severity filter is specified. The filter does not apply to them since they have no attached severity.
Resolved by #13002