Create Direct Link to a Log Analytic Query

This post will show you how you can create a URL to a specific Log Analytics query. When navigated to, this URL will automatically open the Log Analytics Query editor, input your query, and execute it. This URL can be embedded in your custom alerting solutions, used to create a bookmark for queries, or anything else you can think of. All you need to get started is a Log Analytics Workspace and a little bit of PowerShell.

The PowerShell functions you need can be downloaded from my GitHub Gist. To execute it you need to get your Log Analytics Workspace name and the Subscription GUID and Resource Group that contains your workspace. To find these values, you can navigate to your Log Analytics Workspace in the Azure Portal, and copy then from the Overview blade.

One you have this information you simply need to call the Write-LogAnalyticsURL function to create your link. I have provided a couple of examples below.

 

The most recent version of this script, and many more scripts, are available on my GitHub Gist (https://gist.github.com/mdowst).

Leave a Reply

x

We use cookies to ensure the best possible experience on our website. Detailed information on the use of cookies on this site is provided in our Privacy and Cookie Policy. Further instruction on how to disable our cookies can be found there.