Shelton
Shelton

Reputation: 47

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

Upvotes: 1

Views: 789

Answers (1)

Netanel Malka
Netanel Malka

Reputation: 381

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.

Upvotes: 2

Related Questions