{
"@t": "2025-04-30T14:20:16.0163472Z",
"@m": "(\"foobar\") Attempting to clear buffer(1)...",
"@i": "6a4fd379",
"@l": "Debug",
"BufferLength": 1
}
I want to have label of level
which should be equal to the value of @l
.
if the @l
doesn’t exist, then the level
should be info
.
how do i achieve this?
My current config which doesn’t work
stage.regex {
expression = "^(?s)(?P<time>\\S+?) (?P<stream>stdout|stderr) (?P<flags>\\S+?) (?P<content>.*)$"
}
stage.drop {
source = "content"
expression = "^[^\\{].*"
}
stage.replace {
expression = `(\@t)`
replace = "timestamp"
}
stage.replace {
expression = `(\@l)`
replace = "level"
}
stage.json {
source = "content"
expressions = {
time = "timestamp",
level = "level",
}
}
stage.timestamp {
source = "time"
format = "RFC3339Nano"
}
stage.labels {
values = {
level = coalesce("level", "info"),
}
}
stage.output {
source = "content"
}