Hello, I've been trying to read tomcat log and make some analysis such as number of errors and exceptions raised etc. Here is my conf:[code]
input {
file {
path => "/opt/logstash/localhost.log"
start_position => beginning
sincedb_path => "/var/log/logstash/null"
}
}
filter {
grok {
match => { "message" => "(?%{MONTHDAY}-%{MONTH}-%{YEAR} %{HOUR}:%{MINUTE}:%{SECOND}) %{LOGLEVEL:logLevel} %{GREEDYDATA:message}" }
}
mutate {
add_field => { "logLevel" => "%{logLevel}" }
}
date {
locale => "en"
match => ["logdate", "dd-MMM-yyyy HH:mm:ss", "ISO8601"]
target => "@timestamp"
add_tag => ["tmatch"]
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
}
stdout { codec => rubydebug }
}
[/code]
And below is some of the lines in my log file:
09-Jan-2016 18:30:38.722 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
09-Jan-2016 18:30:38.796 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing log4j from [C:\tomcat\apache-tomcat-8.0.26\temp\0-contact-statecollab-ws-15.12-SNAPSHOT-unknown-20151230-1152\WEB-INF\log4j.properties
I have few of questions/problems:
- I got following exception:
Failed parsing date from field {:field=>"logdate", :value=>"19-Jan-2016 18:30:38.722", :exception=>"Invalid format: \"19-Jan-2016 18:30:38.722\" is malformed at \"Jan-2016 18:30:38.722\"", :config_parsers=>"dd-MMM-yyyy HH:mm:ss,ISO8601", :config_locale=>"en", :level=>:warn}
- How should I use logdate instead of @timestamp
- How should I deal with multi line tomcat log?
Any suggestion would be appreciated. Thanks