简体   繁体   中英

How can I store the logs that are generated using log4j into Elasticsearch using filebeat?

I have a log file containing logs(sent from log4j). I would like to store these logs into elasticsearch. The log file is dynamic, meaning that it is constantly loaded with logs from log4j. I don't want to store system logs(which is covered in most tutorials). How can I configure the filebeat.yml file? Even some resources will be helpful. Much appreciated

PS: I'm using Ubuntu 20.04 and this is the path of my file

/home/user/Log/Logging.log

The log in my file looks something like this

2022-01-22 21:04:40 INFO  CalcServlet:135 - sort

You can use the dissector processor:

processors:
  - dissect:
      tokenizer: "%{date} %{time} %{level}  %{coponent}:%{line|integer} - %{message}"
      field: "message"
      target_prefix: "dissect"

A detailed example you can find here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM