Showing posts with label Liferay Kibana. Show all posts
Showing posts with label Liferay Kibana. Show all posts

Sunday, July 18, 2021

Liferay Portal Logs Monitoring with ELKK

This article demonstrates the Liferay Portal Logs monitoring using ELKK stack.


 

Elastic Search

Logstash

Kibana

Kafka

 

 

Previous Article We already implemented Liferay Centralized logging system using Kafka.


Now we will use Logstash to pull the Liferay Logs from Kafka and push to Elastic Search.


Kibana will be used as Visualization and Monitoring tool to analyze the Liferay portal logs.


Following is Architecture diagram

 



Software’s and Tools


 

Windows 10

Java 1.8 or higher

Apache24

Liferay 7.4

Zookeeper-3.7.0

Kafka-2.8.0

Logstash-7.13.3

Kibana-7.13.3

Elasticsearch-7.13.3

 

 

 

Prerequisite


Implement Liferay Centralized logging system from below article which covers the Zookeeper, Kafka and Liferay Installation.

 

http://www.liferaysavvy.com/2021/07/centralized-logging-for-liferay-portal.html

 



It’s time to install and configure ELK stack.

 

  • Install Elastic Search Cluster
  • Install Logstash and configure input/output pipeline and Start
  • Validate Index creation in Elastic Search
  • Install Kibana and Start
  • Create Index Pattern in Kibana and Analyze Liferay portal logs.

 


Install Elastic Search Cluster


Follow the below article to install Elastic Search Cluster


http://www.liferaysavvy.com/2021/07/install-elastic-search-cluster.html



Install Logstash and configure input/output pipeline and Start


Follow the blow article to install log stash


http://www.liferaysavvy.com/2021/07/logstash-installation.html


Above Logstash install with dummy input/output and now it’s time to define actual Logstash pipeline. It’s very important step.


Locate to Logstash config location and create “logstash.conf” file.







 

We have all logs in Kafka now we will define Logstash pipeline input to Kafka and output to elastic search.


Use following configuration in “logstash.conf” file


 

input { 

    kafka {

        bootstrap_servers => "localhost:9092,localhost:9093,localhost:9094"

        topics => ["liferay-kafka-logs"]

    }

}

 

output { 

    elasticsearch {

        hosts => ["localhost:9200","localhost:9201","localhost:9202"]

        index => "liferay-index"

    }

}

 

 



 


Input should have Kafka bootstrap servers and Kafka topics. All logs are sending on “liferay-kafka-logs” topic and same topic was used in Liferay Log4J configuration for Kafka Appender.


Output is Elastic search cluster instances that we already installed. We also need to provide index name so that all logs will be tagged with given index.


Open command prompt and locate to Logstash root directory and use following command to start Logstash.


 

bin\logstash.bat -f config\logstash.conf

 

 






Once Logstash started successfully, all logs are collecting from Kafka and push to Elastic Search.



Install Kibana and Start


Follow the below Article to Install Kibana

 

http://www.liferaysavvy.com/2021/07/kibana-installation.html


 

Validate Index creation in Elastic Search


Make sure Logstash given index in configuration (logstash.conf) should be present in the Elastic search index list.


We can use any one of the Elastic cluster Node to confirm the elastic search health and index details. All should be green in the output.


Use below URL

 

http://localhost:9200/_cat/indices?v

 

 

 



Make sure all Stack Started and following is order. If anything, missed, star/restart in the order.

 

 

Start Zookeeper Cluster

Start Kafka Cluster

Start Liferay Portal Cluster

Start Elastic Cluster

Start Logstash
Start Kibana

 

 

Example screen shows all services started in local machine.






ELKK Important Information

 


 

Zookeeper Cluster

 

localhost:2181

localhost:2182

localhost:2183

 

 

Kafka Cluster

 

localhost:9092

localhost:9093

localhost:9094

 

 

Liferay Portal Cluster

 

http://localhost/

 

 

Elastic Cluster

 

http://localhost:9200/

http://localhost:9201/

http://localhost:9202/

 

 

Logstash

 

 

http://localhost:9600/

 

 

Kibana

 

http://localhost:5601/

 

 

Kafka Topic

 

liferay-kafka-logs

 

 

Elastic Search Index

 

liferay-index

 

 


Define Index Pattern in Kibana


To Monitor logs in Kibana we need to create index pattern in Kibana.


Go to Kibana home page and click on Left side toggle panel and Click on “Stack Management” and add Kibana Index pattern.


 



 

 

Click on Kibana à Index Pattern à Create Index Pattern

 



 

Provide the index name which we were provided in the Logstash file. You can provide exact index name or use wildcard pattern (liferay-*).

 



 

 

Select time field and create index pattern




 

Go to Analytics à Discovery. We can see index in the list.

 



 

 

 


Select newly created index and all the logs’ data visible in the page. Change the time frame to play with logs data.

 





Author

Kibana Installation

Kibana is analytics, visualization and monitoring tool from Elastic stack. It will connect to Elastic search and analyze and visualize the data. Most of the organizations are using Kibana for applications log monitoring. We can build nice Dashboards in Kibana and configure alerts as well.

 

Software and Tools



 

Windows 10

Java 1.8 or higher

kibana-7.13.3

elasticsearch-7.13.3

 

 


Prerequisite



Install Elastic Search and Start Elastic Cluster

 

http://www.liferaysavvy.com/2021/07/install-elastic-search-cluster.html

 

 

Download and Extract


Go to elastic search download page and download Kibana as per your system configurations.

 

https://www.elastic.co/downloads/kibana

 


Direct link as follows

 

https://artifacts.elastic.co/downloads/kibana/kibana-7.13.3-windows-x86_64.zip

 


Extract downloaded zip in local drive

 




 

 

Configure Kibana


Locate to Kibana conf directory and make sure elastic search cluster nodes.



Add/Update “kibana.yml” with elastic cluster nodes according to our elastic cluster installation.

 


 

# The URLs of the Elasticsearch instances to use for all your queries.

elasticsearch.hosts: ["http://localhost:9200","http://localhost:9201","http://localhost:9202"]





Start Kibana


Open command prompt and locate to root directory of Kibana and use below command to start. Pass “kibana.yaml” file as startup --config option for kibata.bat.

 

 

 

bin\kibana.bat --config config\kibana.yml

 

 

 





 

 






Kibana will start on 5601 port and you can access Kibana with below URL. We can Kibana startup information in console logs.

 

 

http://localhost:5601/

 

 






 

 

 

Sample Data in Kibana


Click on Add Data button and navigate to Kibana home page and click on “Try Sample Data








 

We can add any sample data from given options. We can try Sample weblogs.

 

 





 

Once data is added, we can view the data. Click on view data and select Dashboard.

 





 

Sample Web logs data dashboard as follow




 

Reference

 

https://www.elastic.co/guide/en/kibana/current/get-started.html

 



Author


Recent Posts

Recent Posts Widget

Popular Posts