Introduction
A centralized logging system could be used to collect logs from multiple sources and analyze them in a single location. This allows the user to obtain all of the necessary information to easily evaluate, monitor, and troubleshoot any problem in the server.
This document contains an approach to perform a centralized logging system for Liferay using an APM agent.
- Elastic search
- Kibana
- APM server
- APM Agent
Prerequisites
- Liferay DXP/Portal 7.X
- Basic knowledge of Liferay
- Basic Knowledge of Elastic and Kibana
Environmental Requirements
- Liferay Portal or DXP
- Elastic search
- Kibana
- APM Server
- APM agent
Centralized Logging System for Liferay using APM agent

Elastic Search
The elastic configuration file(elasticsearch.yml) should contain the following:
xpack.security.enabled: true
discovery.type: single-node
xpack.security.authc.api_key.enabled: true
Kibana
Kibana’s configuration file(kibana.yml) should contain the following:
elasticsearch.username: "kibana_system"
elastic search.password: "7Go5k7o4T5azKs5SLczd" #your kibana password
APM Agent
Install the APM agent in the server
APM Server
APM server configuration file should contain the following:
apm-server:
host: "127.0.0.1:8200"
output.elasticsearch:
hosts: ["localhost:9200"]
username: "elastic"
password: "elasticpassword"
Liferay Configurations
To integrate Liferay with the APM agent, these steps need to be followed:
- Download the APM agent jar from the Elastic official site or the link http://kibana-host:5601/app/home#/tutorial/apm.
- In the setenv.sh file within CATALINA_OTPS add the location of jar file and also add the following properties.
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/etc/liferay-ce-portal-7.4.3.101-ga101/tomcat-9.0.80/bin/elastic-apm-agent-1.47.1.jar -Delastic.apm.service_name=liferay -Delastic.apm.application_packages=com.liferay,com -Delastic.apm.server_urls=http://127.0.0.1:8200 -Delastic.apm.log_level=ERROR -Delastic.apm.log_file=/etc/liferay-ce-portal-7.4.3.101-ga101/tomcat-9.0.80/logs/agent.log -Delastic.apm.log_sending=true"
Start the Liferay server, log in to the Kibana, and check the APM page for updated metrics.
Now, from Kibana, all the logs related to the server can be monitored.
Conclusion
The centralized logging system is set up for Liferay using APM Agent.