Created
June 6, 2015 08:28
-
-
Save cooniur/bd00e473a071bda0cce9 to your computer and use it in GitHub Desktop.
Logstash + SpringBoot + Logback
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 => [ "/etc/myapp/myapp.log" ] | |
| } | |
| } | |
| filter { | |
| multiline { | |
| pattern => "^(%{LOGBACK_TIMESTAMP})" | |
| patterns_dir => "/etc/logstash/grok/patterns" | |
| negate => true | |
| what => "previous" | |
| } | |
| grok { | |
| patterns_dir => "/etc/logstash/grok/patterns" | |
| # Do multiline matching with (?m) as the above mutliline filter may add newlines to the log messages. | |
| match => [ "message", "(?m)^%{LOGBACK_TIMESTAMP:logtime}%{SPACE}%{LOGLEVEL:loglevel}%{SPACE}%{NUMBER:pid}%{SPACE}---%{SPACE}%{SYSLOG5424SD:thread}%{SPACE}%{JAVACLASS:javaclass}%{SPACE}:%{SPACE}%{GREEDYDATA:logmessage}"] } | |
| } | |
| output { | |
| elasticsearch { host => "localhost" cluster => "elasticsearch" } | |
| } |
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
| JAVACLASS (?:[\.]?[a-zA-Z0-9-]+\.)*[A-Za-z0-9$]+ | |
| MSEC (\d{3}) | |
| LOGBACK_TIMESTAMP %{YEAR}-%{MONTHNUM}-%{MONTHDAY}%{SPACE}%{HOUR}:%{MINUTE}:%{SECOND}.%{MSEC} |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use the
patterns?Create the pattern file at
/etc/logstash/grok/patterns, and put the content frompatternsto it.patterns_dirinfilter.multilineandfilter.grokis where the patterns get referenced.