Search code examples
azureazure-blob-storageazure-log-analyticsazure-monitoring

How to get Container level logs in Azure


In Azure, we have 3 different services -

  • Azure Monitor
  • Azure Log Analytics
  • Storage Analytics

Each provide different level of logs metrics on object storage or blob files.

But is there any way to get Container level detailed logs or Container level aggregate metric logs ?


Solution

  • How to get Container level logs in Azure

    I use Log Analytics Workspace which gives all logs of blob/container level. Firstly, In your storage account , In Diagnostic settings and then on blob:

    enter image description here

    Then click on Add Diagnostic setting:

    enter image description here

    Then Click on all logs and select the Log Analytics Workspace and then save as below:

    enter image description here

    Then in Log Analytics workspace , in Logs use below KQL Query to get container logs:

    StorageBlobLogs
    | extend rith = split(Uri,'/')
    | extend cho= split(rith[3],'?')
    | where cho[0] == "container name"
    | project-away rith,cho
    

    Output:

    enter image description here