Forum Discussion

Richard Oros's avatar
Richard Oros
Copper Contributor
Jun 29, 2018

Command to list backups for the past number of days.

Hi, I'm trying to figure out how to generate a report in Log Analytics/PowerShell that will list VM's that have backed up successfully and which did not. Does anyone have an idea of how I can do this via PowerShell or using Log Analytics?

  • Hi Richard,

    If you backup through Azure, Log Analytics has a solution you can install, named "Azure Backup Monitoring solution" with a dashboard of many backup details:


    You can drill through the charts to see the raw query and results in Log Analytics, or write a custom query like this:

    AzureDiagnostics
    | where TimeGenerated > ago(6d) 
    | where Category == "AzureBackupReport"
    | where OperationName == "Job"
    | where JobOperation_s == "Backup"
    | summarize AggregatedValue = dcount(JobUniqueId_g) by JobStatus_s
    | order by AggregatedValue desc

    which counts how many backup jobs were successful or failed.

    If you backup through another process, you can track the events reported on the Event / SecurityEvent tables.

  • Hi Richard,

    If you backup through Azure, Log Analytics has a solution you can install, named "Azure Backup Monitoring solution" with a dashboard of many backup details:


    You can drill through the charts to see the raw query and results in Log Analytics, or write a custom query like this:

    AzureDiagnostics
    | where TimeGenerated > ago(6d) 
    | where Category == "AzureBackupReport"
    | where OperationName == "Job"
    | where JobOperation_s == "Backup"
    | summarize AggregatedValue = dcount(JobUniqueId_g) by JobStatus_s
    | order by AggregatedValue desc

    which counts how many backup jobs were successful or failed.

    If you backup through another process, you can track the events reported on the Event / SecurityEvent tables.

Resources