AMRIT
  • Introduction
  • Architecture
    • System architecture overview
    • API Guide
    • Integrations
  • Developer Guide
    • Codebase structure
    • Development environment setup
      • System Requirements
      • Software dependencies
      • Installation Instructions
        • For UI repositories
        • For API repositories
      • Common Issues and Troubleshooting
  • Deployment
    • Installation guide
    • CI/CD pipelines
    • Observability
    • Wildfly
      • SSL Configuration for WildFly
  • Data Management
    • Database schema
    • Data privacy and security
    • Data export
    • Reporting
      • Integrating DHIS2 with AMRIT
      • Example Python Scripts
  • Community and Support
    • Contributing to AMRIT
    • How to get help
    • Code of conduct
    • Contribution guidelines
Powered by GitBook
On this page
  1. Deployment

Observability

PreviousCI/CD pipelinesNextWildfly

Last updated 3 months ago

Observability in AMRIT aims to implement a comprehensive solution that provides a unified view of application logs and metrics, thereby automating error detection and troubleshooting processes. This initiative aims to significantly reduce the time spent on manual monitoring, enhance incident response times, and minimize system downtime by leveraging real-time data visualization and advanced analytics.

We adopted the ELK stack to achieve the above objective.

Setting up ELK on Ubuntu:

  1. Install and configure ELK on UBUNTU as a single node cluster.

  2. 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

  3. Copy the folder to the server (preferably in the Wildfly installation location)

  4. apm_agent folder contains two files elastic-apm-agent.jar, elasticapm.properties

    Add the below lines in elasticapm.properties

    server_url=http://<private-ip>:8200

    enable_log_correlation=true

    environment=hyd-sandbox

  5. Filebeat Setup on Application Nodes

  • Filebeat is used to forward logs from our application nodes to Logstash or Elasticsearch.

  • Create a Logs folder inside Wildfly

Switch to Wildfly/bin/ and edit standalone.conf.bat add below line under wildfly folder

set "JAVA_OPTS=%JAVA_OPTS% -javaagent:E:\\AppServer\\wildfly-30.0.0.Final\\wildfly-30.0.0.Final\\apm_agent\\elastic-apm-agent-1.52.0.jar"

restart wildfly

check if traces are visible in APM section of kibana

restart filebeat

check for logs under filebeat in kibana

Do the changes in github repo under ci-properties & application properties for each service line.

Example:

ADD a new line

Add below two lines:

logging. Path=logs/

4.1. Define Environment Variables in Jenkins Pipeline:

In the Jenkins pipeline, 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'

5.4. Check Application Logs:

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:

  • 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.

Conclusion

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 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.

Download and

Download to the server (preferably in the filebeat installation location)

Do the changes in Filebeat.yml as mentioned

Goto

Goto

=logs/hwc-api.log

Go to Kibana’s dashboard by accessing its URL in a browser

http://localhost:5601
apm_agent
install
http_ca.crt
here
common-ci.properties
logging.file.name=@env.HWC_API_LOGGING_FILE_NAME@
application.properties
logging.file.name
http://localhost:5601