Created
November 25, 2019 10:50
-
-
Save zouzias/b46363fb6442e82e92e5c356251fb8f6 to your computer and use it in GitHub Desktop.
Logstash split by newline madness
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
stdin { } | |
} | |
filter { | |
json { | |
source => "message" | |
} | |
mutate { | |
copy => { "message" => "message_head" } | |
} | |
mutate { split => ["message_head", " | |
"] } | |
mutate { | |
# save the first element of the array as the event_name. | |
add_field => ["event_name", "%{[message_head][0]}" ] | |
# Remove message_head field | |
remove_field => ["message_head"] | |
} | |
} | |
output { | |
stdout { codec => rubydebug } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment