...
- Install and configure ELK on UBUNTU as single node cluster.
Check Elasticsearch:
- Test Elasticsearch by accessing its URL in a browser: curl -X GET "localhost:9200/"
- If Elasticsearch is running correctly, you should see a JSON response with Elasticsearch cluster details.
Check Kibana:
- Go to Kibana’s dashboard by accessing its URL in a browser http://localhost:5601
Copy the apm_agent folder to the server (preferably in the wildfly installation location)
apm_agent folder contains two files elastic-apm-agent.jar, elasticapm.properties
Add below lines in elasticapm.proerties
server_url=http://<private-ip>:8200
enable_log_correlation=true
environment=hyd-sandbox
- Filebeat Setup on Application Nodes
...
4.1. Define Environment Variables in Jenkins Pipeline:
In the Jenkins pipeline, add an set the environment variable
env.HWC_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/hwc-api.log'
...
Check if the logs are being generated at the specified location (e.g., logs/inventory-api.log) and whether they are being processed by Filebeat and appear in Kibana.
Check Kibana:
- Go to Kibana’s dashboard by accessing its URL in a browser http://localhost:5601
- Navigate to the "Discover" section and check if logs are being indexed in Elasticsearch.
Troubleshooting
- Filebeat not sending logs: Check the Filebeat logs at /var/log/filebeat/ for errors.
- Elasticsearch or Kibana not working: Review the logs in /var/log/elasticsearch/ and /var/log/kibana/.
- Application not writing logs: Ensure that the application has access to the specified log path and that the environment variable is being correctly passed from Jenkins.
...
This document outlines the process of configuring ELK for log collection from our application. we have set up Elasticsearch, Logstash, and Kibana on Ubuntu, configured Filebeat for log forwarding, and adjusted your our application’s properties file to use environment variables for log paths. The Jenkins pipeline is configured to pass the necessary environment variables to the application, ensuring that the logs are written to the correct location.
...