By: Joe Gavin | Updated: 2018-03-20 | Comments | Related: > Azure
Problem
You want an easy way to query your Microsoft Azure Log Analytics data in the OMS Log Search. Check out this tip to learn how.
Solution
In order to easily query the data, we will be using the ability to add filters from the left side of the Log Search window that appears after you run even a basic query.
Note: It’s assumed you’re using the new and not the legacy Log Analytics query language.
Login to Azure Portal
Let’s get started by logging in to the Azure Portal. Next, search for Log Analytics.
Choose your Log Analytics workspace if prompted.
Click on OMS Portal to open the portal in another tab.
Click on the Log Search button on the left.
Building Azure Log Analytics Query
And we’re ready to get down to building a query. For our example we’ll start by searching the performance logs to return all the performance records for the default period.
- Type Perf (case sensitive) in the query window
- Click on the Search button
Now you can:
- Choose the timeframe you want data from
- Select machine you want data from
- Choose performance counter you want
After we’ve defined our filter we can:
- Run the query
- Export results to a .csv
- Generate a Power BI query
- Create a Log Analytics Alert
- Save the query
Let’s look at each option.
Run the Query
Running the query generates a list where you can view details on each entry. Click table for a table view.
Export Results
Export up to 5000 rows of the results to a .csv file.
Generate a Power BI query
Generate a Power BI query to a .txt file.
Create a Log Analytics Alert
Create an alert - https://www.mssqltips.com/sqlservertip/5272/create-an-alert-in-microsoft-azure-log-analytics/.
Save your query
Follow below to save the query.
More Options
- Add it to your Favorites
- Search History
- Open results in Advanced Analytics
Next Steps
Here are some links with more information:
- Create a Log Analytics alert: https://www.mssqltips.com/sqlservertip/5272/create-an-alert-in-microsoft-azure-log-analytics/
- Reference if you’re familiar with the legacy Log Analytics language: https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-log-search-transition
- Getting Started With the Log Analytics Portal: https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-log-search-transition
- Getting Started With Log Analytics Queries: https://docs.loganalytics.io/docs/Learn/Getting-Started/Getting-started-with-queries
About the author
This author pledges the content of this article is based on professional experience and not AI generated.
View all my tips
Article Last Updated: 2018-03-20