Learn how to use Azure Monitor logs to analyze logs generated by Apache Kafka on HDInsight.
Athugasemd
This article was recently updated to use the term Azure Monitor logs instead of Log Analytics. Log data is still stored in a Log Analytics workspace and is still collected and analyzed by the same Log Analytics service. We are updating the terminology to better reflect the role of logs in Azure Monitor. See Azure Monitor terminology changes for details.
Logs location
Apache Kafka logs in the cluster are located at /var/log/kafka. Kafka logs aren't saved or persisted across cluster life cycles, regardless if managed disks are used. The following table shows the available logs.
Log
Description
kafka.out
stdout and stderr of the Kafka process. You'll find Kafka startup and shutdown logs in this file.
server.log
The main Kafka server log. All Kafka broker logs end up here.
controller.log
Controller logs if the broker is acting as controller.
statechange.log
All state change events to brokers are logged in this file.
kafka-gc.log
Kafka Garbage Collection stats.
Enable Azure Monitor logs for Apache Kafka
The steps to enable Azure Monitor logs for HDInsight are the same for all HDInsight clusters. Use the following links to understand how to create and configure the required services:
Create a Log Analytics workspace. For more information, see the Logs in Azure Monitor document.
It may take around 20 minutes before data is available for Azure Monitor logs.
Query logs
From the Azure portal, select your Log Analytics workspace.
From the left menu, under General, select Logs. From here, you can search the data collected from Kafka. Enter a query in the query window and then select Run. The following are some example searches:
Write log queries to gain insights into your business, IT operations, and performance. Use Kusto Query Language (KQL) to extract log data in Azure Monitor Log Analytics.
Demonstrate understanding of common data engineering tasks to implement and manage data engineering workloads on Microsoft Azure, using a number of Azure services.
Learn how to directly connect to Kafka on HDInsight through an Azure Virtual Network. Learn how to connect to Kafka from development clients using a VPN gateway, or from clients in your on-premises network by using a VPN gateway device.