Share via

Log Analytic Workspace Query Filtering by VM Tags

Mohamed jihad bayali 1,141 Reputation points
2022-10-31T09:05:11.587+00:00

Hello Team,

I hope you're doing fine,

Is there a way to apply kusto log queries and filter by VM tags ?

For example :

InsightsMetrics
| where Origin == "vm.azm.ms"
| where Namespace == "Processor" and Name == "UtilizationPercentage"
And then add a line to filter by VM tags so that this query apply only on the VMs that has that particular tag ?

I'm seing a tag row on the log analytic workspace results, but it seems that it's not the same Tag that i'm looking for since it's it show more of a metric tag and not the VM tag that i'm looking for.

I just want to know if this is something that we can do with Kusto log queries on a log analytic workspace or not

Thank you in advance

Azure Monitor
Azure Monitor

An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.

0 comments No comments

Answer accepted by question author
  1. George Moise 2,361 Reputation points Microsoft Employee
    2022-10-31T09:22:03.16+00:00

    Hi @Mohamed jihad bayali ,

    You will not be able to find the Resource Tags of a Virtual Machine in the Log Analytics tables (like InsightsMetrics) where an Azure Virtual Machine agent sends various types of data once connected to an Azure Log Analytics Workspace.

    The Resource Tags are stored and readable from Azure Resource Graph, but although is using Kusto Queries as well to read data from it, it cannot be queried from a Log Analytics Workspace / Azure Monitor perspective.

    This is why, if you need to put the two information together (data about VMs from Log Analytics and information about VMs from Resource Graph), I recommend you create and use a Workbook, because in Workbooks you can merge (join) data from multiple data sources (one is Log Analytics and one Resource Graph) and then present it in the same visual.

    Check this article to see how it can be done in Workbooks. (there's also a nice video in this article demonstrating how is done)

    I hope it helps!
    If so, please accept the answer.

    BR,
    George

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Michael Durkan 12,256 Reputation points MVP
    2022-10-31T09:11:55.88+00:00

    Hi

    check this post which I think is what you are looking for:

    https://cloudbunnies.wordpress.com/2020/09/10/azuremonitor-how-to-use-resource-tags-for-filtering-queries-in-workbooks/

    Thanks

    Michael Durkan

    • If the reply was helpful please upvote and/or accept as answer as this helps others in the community with similar questions. Thanks!

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.