debugd: Use very basic JSON regex filter before JSON filter

This commit is contained in:
Nils Hanke 2023-03-20 11:33:51 +01:00 committed by Nils Hanke
parent 6f16e0b6fd
commit 3fceb2207d

View File

@ -28,6 +28,11 @@ filter {
# Parse structured logs for following systemd units. # Parse structured logs for following systemd units.
if [systemd][unit] in ["bootstrapper.service", "constellation-bootstrapper.service"] { if [systemd][unit] in ["bootstrapper.service", "constellation-bootstrapper.service"] {
# skip_on_invalid_json below does not skip the whole filter, so let's use a cheap workaround here.
# See:
# https://discuss.elastic.co/t/skip-on-invalid-json-skipping-all-filters/215195
# https://discuss.elastic.co/t/looking-for-a-way-to-detect-json/102263
if [message] =~ "\A\{.+\}\z" {
json { json {
source => "message" source => "message"
target => "logs" target => "logs"
@ -50,6 +55,7 @@ filter {
} }
} }
} }
}
output { output {
opensearch { opensearch {