Skip to content

Instantly share code, notes, and snippets.

@zouzias
Created November 25, 2019 10:50
Show Gist options
  • Save zouzias/b46363fb6442e82e92e5c356251fb8f6 to your computer and use it in GitHub Desktop.
Save zouzias/b46363fb6442e82e92e5c356251fb8f6 to your computer and use it in GitHub Desktop.
Logstash split by newline madness
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