Kusto Query Language (KQL), is a query language developed by Microsoft for querying and analyzing data. KQL is specifically designed for working with structured, semi-structured, and unstructured data, and it offers a simple and intuitive syntax for expressing complex queries.
KQL is used in log analytics, security monitoring, and business intelligence. It allows users to extract insights from vast amounts of data by using a combination of filtering, aggregating, and transforming operations. With its rich set of operators, functions, and control flow statements, KQL enables users to perform advanced analytics and create sophisticated queries.
In the next few blog post’s we will be going through how to send data to a log workspace and creating KQL queries to show how we can visualize and gather data.
I have wanted to do more with KQL and I am using this series to improve my own KQL and hopefully it will be of use to other if you are just starting out.
First step is we need to create a Azure Log workspace.
Go to Log Analytics workspace blade in Azure and click create.
- Select a subscription
- Create or select and existing resource group
- Give the workspace a name
- Set the region
Select tags if needed, review and create.
It will take a few minutes to finish deploying.
Once we have the log workspace created we can start to send data that we can then query.
First we will be sending storage account diagnostic data.
To enabled to go the storage account and select diagnostic settings.
Enabled the diagnostic for the required storage type, I am going to enable for blob and file.
Click on the storage type and click add diagnostic settings.
Select the logs to send and the log analytics workspace.
After enabling for both file and blob the diagnostic status should now show as enabled.
We will can generate some data by creating and delete some blob and azure file share.
Once we have some data can start to write our KQL query. First we can run against the full table by using StorageBlobLogs. I used the Azure monitor reference to find the correct table to use.
https://learn.microsoft.com/en-us/azure/azure-monitor/reference/
If we want to select specify rows and filter the data that is returned we can use the where operator. In below example I am select only the storage write results.
StorageBlobLogs
| where Category == 'StorageWrite'
In the next post we will go through using different operators like project, summarize, rendering…