Sending Json Format Log to Kibana Using Filebeat, Logstash and Elasticsearch?
To send JSON format logs to Kibana using Filebeat, Logstash, and Elasticsearch, you need to configure each component to handle JSON data correctly. Here’s a step-by-step guide to set up the pipeline:
1. Filebeat Configuration
Filebeat will collect and forward the JSON logs to Logstash.
Filebeat Configuration (filebeat.yml):
Define Input: Configure Filebeat to read the log files containing JSON data.
Define Output to Logstash: Configure Filebeat to send the data to Logstash.
Adjust the
hostsvalue to match the address and port where Logstash is listening.
2. Logstash Configuration
Logstash will receive the data from Filebeat, process it, and send it to Elasticsearch.
Logstash Configuration (logstash.conf):
Define Input: Configure Logstash to receive data from Filebeat.
Define Filters: Optionally, use filters to process or enrich the JSON data if needed. For example, you might add fields or modify the data structure.
Adjust this filter as needed based on your JSON structure and requirements.
Define Output: Configure Logstash to send the data to Elasticsearch.
3. Elasticsearch Configuration
Ensure Elasticsearch is running and accessible to receive data from Logstash.
Check Elasticsearch Status:
Use the following command to check if Elasticsearch is up and running:
Create Index Patterns in Kibana:
- Go to Kibana and create index patterns to match the indices where your logs are stored.
- Navigate to
Management->Index Patternsand create a pattern that matchesyour-index-name-*.
4. Kibana Configuration
In Kibana, you can create visualizations and dashboards to analyze your JSON logs.
- Create Index Pattern:
- In Kibana, navigate to
Management->Index Patterns. - Create a new index pattern matching the indices created by Logstash (
your-index-name-*).
- In Kibana, navigate to
- Explore Data:
- Go to
Discoverto view the incoming logs. - Create visualizations and dashboards based on your data.
- Go to
Summary
- Filebeat: Configured to read JSON logs and forward them to Logstash.
- Logstash: Receives data from Filebeat, optionally processes it, and sends it to Elasticsearch.
- Elasticsearch: Stores the data and makes it available for querying.
- Kibana: Create index patterns, visualizations, and dashboards to analyze the JSON logs.
By following these steps, you should be able to successfully send JSON format logs from Filebeat to Kibana using Logstash and Elasticsearch.