Enable Diagnostics for Azure Event Hubs
Event Hubs is a streaming and event ingestion service on the Microsoft Azure Platform capable of receiving and processing millions of events per second. The service will allow you to process and analyze the massive amounts of data produced by your connected devices and applications.
Once you have an Event Hub namespace and hub provisioned as described in the tips around creating a namespace and adding an Event Hub, you can start using Event Hubs and enable diagnostics for monitoring and troubleshooting purposes.
You can leverage Azure Monitor Logs to monitor your Event Hub namespace since they offer integration with them. With Azure Monitor Logs you centrally consolidate all the logs of your Event Hub namespace. Furthermore, you can use Log Analytics in the Azure portal and then either directly analyze the data, create queries and visualizations, and alert rules.
Setup of directing your log telemetry to Azure Monitor Logs is straight forward. You create a Log Analytics workspace first; subsequently, you go to your Event Hub namespace, and choose Diagnostic Settings and configure the settings. Note that there are log categories you can select.
Once you have configured your diagnostic settings and send logs to the specified analytics workspace, you can access the log telemetry via Log Analytics Workspace under General. Next, you can start creating queries on the log data.
Currently, with Event Hub several logs are supported – which are captured when any operation within an Event Hub namespace occurs. Operations such as event hub creation, autoscaling, and Kafka (logs and errors). Furthermore, the operational logs are stored in JSON format.
With diagnostics set, you can query and analyze your service bus log data. Moreover, you can gain insights into the service operation and troubleshoot quickly. The query language for Log Analytics is Kusto, and its syntax and examples are available on the Microsoft docs.