Some days ago, I was attending a DevOps class, and my teacher explained the Elasticsearch service functionality. One of the uses cases in Elasticsearch is Sitecore. That caught my attention and was my motivation to start this blog.
I did research and I found this link How to use ElasticSearch and Kibana to store and monitor Sitecore logs. Part 2 | LinkedIn written by Andrey Molchanov which was a useful resource to do this integration.
As a prerequisite, it is required the access with a valid user to Elasticsearch cloud service in this link https://www.elastic.co/. You can get a free trial account.
In summary, the general steps of this blog are:
- Create a new deployment inside the Elasticsearch service
- Installation and configuration of Filebeat
- Integration to collect the Sitecore log information
- View log data in Kibana
Step 1 Create a new deployment inside Elasticsearch service
First, to create a new deployment you have access to https://www.elastic.co/ and select the option “Create deployment” as bellow. You have to provide a deployment name and at the end the credential will be generated and download. Keep the credentials which will be used later.
Step 2 Installation and configuration of Filebeat
Second, install Filebeat on the Sitecore server which has the logs to be sent to Elasticsearch service. The link with the full documentation to install Filebeat is the following:
Filebeat quick start: installation and configuration | Filebeat Reference [8.2] | Elastic
To install on Windows operating system follow the next steps:
- Download the Filebeat Windows zip file from the downloads page
- Extract the contents of the zip file into
C:\Program Files
. - Rename the
filebeat-<version>-windows
directory toFilebeat
- Open a PowerShell prompt as an Administrator, and run the following commands to install Filebeat as a Windows service
PS > cd 'C:\Program Files\Filebeat'
PS C:\Program Files\Filebeat> .\install-service-filebeat.ps1
Once Filebeat has been installed on your server, that is display appears as Windows services as bellow:
Open the file filebeat.yml located in Filebeat installation directory and change the section “Filebeat inputs” with the following information. Set the path with the Sitecore logs location.
Step 3 Integration to collect the Sitecore log information
Third, to configure the Elasticsearch logs module with Filebeat you have to click on your deployment as bellow
Select “Add Integrations”
Locate the Elasticsearch Logs integration as bellow:
The following screen is displayed with the instructions to configure the integration selected.
The step 1 is already done because is Filebeat is installed. For the step 2, open the file filebeat.yml and go to the “Elastic Cloud” section and include the cloud.id and cloud.auth data as bellow.
To get the cloud.id, access to the Elasticsearch cloud service. Click on the configuration icon in the deployment as bellow:
The cloud.auth has this format “<user>:<password>”. This information can be copied from the credentials download at the deployment creation step.
Continue with the integration instructions and run the following PowerShell commands indicated in the step 3 and 4 in the guide as bellow:
./filebeat modules enable elasticsearch
./filebeat setup
./filebeat -e
For step 3, it was not required in my case change anything inside the file modules.d/elasticsearch.yml.
After the step 4 is executed, restart the FileBeat windows service.
Step 4 View log data in Kibana
You can access Kibana to see the Sitecore log data exported to the Elasticsearch service. You have to click on Discover left menu item.
Once you click on Discover the following screen will be displayed:
You can check the detail of each row as bellow:
That is all to get the integration between Elasticsearch and Sitecore. See you next time.