Log Analytics For Automation Jobs

Copper Contributor

Good day,

I am new to log analytics and I have a runbook that is used by 40ish different schedules with different inputs.  I am able to get success/failure notification that I am looking for, but so far I can only seem to get the name of the runbook in the query on Log Analytics.  How can I get the input parameters or schedule name to into the query?

 

Thank you,

Michael

1 Reply

@Dep67 

 

Please also take a look at https://abcdazure.azurewebsites.net/monitoring-and-alerting-runbooks-with-log-analytics-and-azure-mo...

 

I suspect you'll also need another data sources for things like schedule etc.. as that wouldn't be a logged event (you can see the TimeGenerated - as per the above queries, which tells you when it ran but not the schedule itself).  This is remit of logs to show the data, not necessarily the configuration - put another way, you may set up an Automation runbook that only fires once a year, and if you only keep 31days of logs you wont know about it (granted you can alert on the event when it fires)).

You may need an Azure Resource Graph query (ARG) that get the info from the Azure API.  e.g.

resources
 | where type == "microsoft.automation/automationaccounts/runbooks"


The above is a sample...to give you an idea https://docs.microsoft.com/en-us/azure/governance/resource-graph/

You can bring that ARG data together with Log Analytics within a Azure Monitor workbook, using the merge feature.