I've been breaking my head on this problem I have with filebeat. The application log that needs to be send to Logstash logs 2 lines with the same timestamp. I've added an example below (removed IP/Ports):
Mar 22 12:41:03 localhost haproxy[17727]: Connect from ip:port to ip:port (fe_web-port/TCP)
Mar 22 12:41:03 localhost haproxy[17727]: Connect from ip:port to ip:port (fe_web-port/TCP)
When these lines are pushed to logstash -> elasticsearch they show up as a single event in the message field:
"source": "/var/log/haproxy/haproxy-traffic.log",
"message": [
"Mar 22 16:38:04 localhost haproxy[17727]: Connect from ip:port to ip:port
(fe_web-port/TCP)"
,
"Connect from ip:port to ip:port (fe_web-port/TCP)"
These lines need to be seperated as multiple lines, but I am stuck on what config Filebeat needs to do this. So my question is:
Can Filebeat be configured that it will create multiple lines, even when the timestamps are the same?
filter {
if "haproxy" in [tags] {
if "events" in [tags] {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP} %{SYSLOGHOST} %{SYSLOGPROG}: %{GREEDYDATA:message}" }
}
}
if "traffic" in [tags] {
grok {
match => { "message" => "%{HAPROXYHTTP}" }
match => { "message" => "%{SYSLOGTIMESTAMP} %{SYSLOGHOST} %{SYSLOGPROG}: %{GREEDYDATA:message}" }
}
}
}
}
In the traffic part of haproxy there are log lines that are the same as in the events log, so thats why there is a similar grok filter in the tag for "traffic".
Both Filebeat and Logstash are running on version 6.1.3.
Thank you for your response. No I am not using an fingerprint or custom event_id's in logstash, but I quickly read your blogpost and maybe that is something that we need to consider implementing.
I'm gonna take a closer look at fingerprinting...
At this moment the duplicates are removed and are joined into the same message field. So maybe with fingerprinting I can set the duplicates to get their own field in ES.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.