Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[processor/filter] Add functionality to allow filtering on SeverityNumber #13002

Merged
Prev Previous commit
Next Next commit
add numeric severities
  • Loading branch information
BinaryFissionGames authored and djaglowski committed Aug 11, 2022
commit b90692a01e36c00cf6a7c9058f2d1cdf83d79b0e
24 changes: 24 additions & 0 deletions processor/filterprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,30 @@ const (
)

var severityToNumber = map[string]plog.SeverityNumber{
djaglowski marked this conversation as resolved.
Show resolved Hide resolved
"1": plog.SeverityNumberTRACE,
"2": plog.SeverityNumberTRACE2,
"3": plog.SeverityNumberTRACE3,
"4": plog.SeverityNumberTRACE4,
"5": plog.SeverityNumberDEBUG,
"6": plog.SeverityNumberDEBUG2,
"7": plog.SeverityNumberDEBUG3,
"8": plog.SeverityNumberDEBUG4,
"9": plog.SeverityNumberINFO,
"10": plog.SeverityNumberINFO2,
"11": plog.SeverityNumberINFO3,
"12": plog.SeverityNumberINFO4,
"13": plog.SeverityNumberWARN,
"14": plog.SeverityNumberWARN2,
"15": plog.SeverityNumberWARN3,
"16": plog.SeverityNumberWARN4,
"17": plog.SeverityNumberERROR,
"18": plog.SeverityNumberERROR2,
"19": plog.SeverityNumberERROR3,
"20": plog.SeverityNumberERROR4,
"21": plog.SeverityNumberFATAL,
"22": plog.SeverityNumberFATAL2,
"23": plog.SeverityNumberFATAL3,
"24": plog.SeverityNumberFATAL4,
"TRACE": plog.SeverityNumberTRACE,
"TRACE2": plog.SeverityNumberTRACE2,
"TRACE3": plog.SeverityNumberTRACE3,
Expand Down
5 changes: 5 additions & 0 deletions processor/filterprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,11 @@ func TestLogSeverity_severityNumber(t *testing.T) {
sev: logSeverity("unknown"),
num: plog.SeverityNumberUNDEFINED,
},
{
name: "Numeric Severity",
sev: logSeverity("9"),
num: plog.SeverityNumberINFO,
},
}

for _, tc := range testCases {
Expand Down