I use a 5.1.2 verisón of logstash, filebeat, elasticsearch... "ELK"
I try send logs from tomcat server (catalina.out and apps-java logs) but can´t because have problems of config of logstash multiline filter/codec.
I follow this instructions
https://blog.lanyonm.org/articles/2014/01/12/logstash-multiline-tomcat-log-parsing.html
Logstash.conf is this:
input {
beats {
port => 9000
}
}
filter {
if [type] == "tomcat-pro" {
codec => "multiline" {
patterns_dir => "/opt/logstash/patterns"
pattern => "(^%{TOMCAT_DATESTAMP})|(^%{CATALINA_DATESTAMP})"
negate => true
what => "previous"
}
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "tomcat-pro"
}
}
Logstash receives files of filebeat.
Filebeat.yml
filebeat.prospectors:
- input_type: log
document_type: tomcat-pro
paths:
- /opt/tomcat-test/logs/catalina.out
When i start the service the console show me this:
[2017-01-26T13:10:33,712][ERROR][logstash.agent ] fetched an invalid config {:config=>"input {\n beats {\n port => 9000\n }\n}\n\nfilter {\n if [type] == \"tomcat-pro\" {\n codec => \"multiline\" {\n patterns_dir => \"/opt/logstash/patterns\"\n pattern => \"(^%{TOMCAT_DATESTAMP})|(^%{CATALINA_DATESTAMP})\"\n negate => true\n what => \"previous\"\n }\n }\n}\n\noutput {\n elasticsearch {\n hosts => [\"localhost:9200\"]\n index => \"tomcat-pro\"\n } \n}\n", :reason=>"Expected one of #, { at line 9, column 11 (byte 96) after filter {\n if [type] == \"tomcat-pro\" {\n codec "}
Summary:
fetched an invalid config
reason=>"Expected one of #, { at line 9, column 11 (byte 96) after filter {\n if [type] == \"tomcat-pro\" {\n codec "}
I read in google that is recommended to use multiline in filebeat rather than in logstash, but i dont config very well...
Someone can help me? :(
PD: Im spanish, sorry for "google translate". Si puedes responder en español, sería mucho mejor ;)