KQL Query to verify diagnostic logs

Mohammed Altamash Khan 2,076 Reputation points
2022-08-10T00:10:10.273+00:00

Hello Folks

If i set a diagnostic setting for example of a storage account , how can i verify the log is coming to sentinel in last few min or hrs .
Usually we use Azure diagnostic and Azure activity then pipe to build a single query but i need a multipurpose one.

I need to verify all type of resources log are coming to Sentinel , without changing much in query . Like altering the name of resource before running query.
Need a query in way that i can edit the name of resource and can able to verify another type of resources as well.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,797 questions
Microsoft Sentinel
Microsoft Sentinel
A scalable, cloud-native solution for security information event management and security orchestration automated response. Previously known as Azure Sentinel.
974 questions
0 comments No comments
{count} votes

Accepted answer
  1. George Moise 2,346 Reputation points Microsoft Employee
    2022-08-10T08:26:00.583+00:00

    Hello @Mohammed Altamash Khan
    Here are some Kusto Queries to help you analyzing Azure Diagnostic logs:

    1. Find what type of resources (and how many) are sending Diagnostic Logs to your Log Analytics Workspace: AzureDiagnostics
      | summarize Resources = dcount(ResourceId) by ResourceType
      | order by Resources desc
    2. Find the ResourceID of all Resources sending Azure Diagnostics for a specified Resource Type: AzureDiagnostics
      | where ResourceType == "a type resulted from the previous query"
      | distinct ResourceId
    3. Return all Azure Diagnostics records sent by a specified Resource (using a Resource Id from the previous query): AzureDiagnostics
      | where ResourceId == "a resource id returned from the previous query"

    Note: I recommend you use the ResourceId property to filter for a specific resource (rather than the Resource (Name), as you might have multiple resources with the same name, but the ResourceId is unique)

    I hope that the above helps and that this is what you were looking for.

    BR,
    George

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. George Moise 2,346 Reputation points Microsoft Employee
    2022-08-10T09:04:59.297+00:00

    Hi again,
    You can add the following to your query:

    | summarize max(TimeGenerated) by Resource

    or by ResourceId or ResourceType to see the timestamp of the newest ingested record for your grouping category.

    BR,
    George

    1 person found this answer helpful.
    0 comments No comments