I am Ansari, Solution Architect working for SAI-DIGITAL writing this post to give some idea on Kibana to filter out console logs
In this post, you will learn to filter out logs in Kibana to make it look like console logs of hybris and basic details on how logs arrives in kibana.
As we all aware Kibana is an integral part of ELK Stack (ElasticSearch, LogStash, Kibana).
Kibana provides us wonderful UI to work with logs which are indexed in ElasticSearch. Logstash is responsible for collecting logs from server and push it to elasticsearch.
In CCV2 environment we do not have option to connect to server via VPN and access the logs using winscp or putty. This is not possible due to various security reason. So SAP push all the logs generated in server to elasticsearch and kibana provides us an UI to filter out logs available on elasticsearch.
Since All the logs are pushed to elasticsearch, kibana lists down all the logs mixed up in the discover tab as illustrated below
Now Let us understand step by step approach to filter out logs
Step 1 : Login to your cloud portal and choose the environment for which the logs to be filtered
Step 2 : Goto the services tab and select storefront as shown below
Step 3: Click the button as show below
Step 4 : clicking the above button will open up kibana with filter already applied for storefront alone. So you will see only logs related to storefront which is similar to what you see on console log as shown below
Step 5: We can add couple of more filters to make the logs look even better. The actual messages of console logs are indexed in the field called logs.message so adding this filter as a column will give more readability. The below image illustrates how to do that
Step 6: Adding the above column will make the search list as shown below
Step 7 : To eliminate the events with empty logs.message you can add the filter as illustrated below
Similarly you can add more filters on available fields and apply changes for better filtering. Kibana also provides features to create custom fields which will have customized value from your log message as well.
Note: There is a 5 seconds delay in kibana to show up the logs. It has page auto refresh minimum of 5 seconds which can be configured on top right corner of kibana page. You can also switch off the auto-refresh when you investigate on logs. This will help you stop logs piling up to kibana for sometime.
Hope this helps you filtering logs on Kibana.
Thanks for reading !