Last active
January 29, 2023 08:24
-
-
Save daniellavoie/43e25d1fb74bc99dc3915a03901777e2 to your computer and use it in GitHub Desktop.
Logstash grok filter for Logback Logger used by Spring Boot applications
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 { | |
file { | |
path => /tmp/application.log | |
codec => multiline { | |
pattern => "^(%{TIMESTAMP_ISO8601})" | |
negate => true | |
what => "previous" | |
} | |
} | |
} | |
filter { | |
if [message] =~ "\tat" { | |
grok { | |
match => ["message", "^(\tat)"] | |
add_tag => ["stacktrace"] | |
} | |
} | |
grok { | |
match => [ "message", | |
"(?<timestamp>%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{TIME}) %{LOGLEVEL:level} %{NUMBER:pid} --- .+? :\s+(?<logmessage>.*)" | |
] | |
} | |
date { | |
match => [ "timestamp" , "yyyy-MM-dd HH:mm:ss.SSS" ] | |
} | |
mutate { | |
remove_field => ["message"] | |
} | |
} | |
output { | |
elasticsearch { | |
hosts => ["localhost:9200"] | |
index => "daniel-app-%{+YYYY.MM.dd}" | |
document_type => "daniel-app" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are god among men.