I am trying to export log message (JSON) from client side log to ELK Server through FileBeat.
My custom log (log4j) will produce JSON output in a file through log4j.RollingFileAppender. I know, I have to have only one JSON String (Object) per line.
I want Filebeat to read JSON line by line from the log file and send to Remote ELK Server.
File beat should not miss any JSON line, even though log4j rotates the log file
I have installed Filebeat in my client machine.
I just need to know, a concreate settings that I have to set in filebeat.yml file.
When I start Filebeat, it starts without any error. But once .log file generated JSON string as log.
It tries to establish connection to logstash.. and throughs following error..
WARN DNS lookup failure "http://<logstashserver-ip>:6000": lookup http://<logstashserver-ip>:6000: getaddrinfow: No such host is known. ERR Connecting error publishing events (retrying): lookup http://<logstashserver-ip>:6000: getaddrinfow: No such host is known.
I am able telnet from my window laptop (where I run the filebeat) to logstash server..
Checkout the instructions for configuring Filebeat and Logstash. Let us know if you have problems after following the config examples and instructions there.
This file written by Log4j framework.. and it rotates as soon as it attains the specified file size.
because of this, file beat looses bottom 20 lines of log messages (JSON String) on every rotation.
Has anyone faced this problem? How this could be fixed?
Well if you use a glob pattern that also matches the rotated files, then filebeat can follow the rotated file and continue reading it to the end. Try this if your rotation moves x.log to x.log.1.
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.