Skip to content

Latest commit

 

History

History
71 lines (59 loc) · 5.81 KB

automation-solution-vm-management-logs.md

File metadata and controls

71 lines (59 loc) · 5.81 KB
title description services ms.subservice ms.date ms.topic
Query logs from Azure Automation Start/Stop VMs during off-hours
This article tells how to use Azure Monitor to query log data generated by Start/Stop VMs during off-hours.
automation
process-automation
04/01/2020
conceptual

Query logs from Start/Stop VMs during off-hours

Azure Automation forwards two types of records to the linked Log Analytics workspace: job logs and job streams. This article reviews the data available for query in Azure Monitor.

Job logs

Property Description
Caller Who initiated the operation. Possible values are either an email address or system for scheduled jobs.
Category Classification of the type of data. For Automation, the value is JobLogs.
CorrelationId GUID that is the Correlation ID of the runbook job.
JobId GUID that is the ID of the runbook job.
operationName Specifies the type of operation performed in Azure. For Automation, the value is Job.
resourceId Specifies the resource type in Azure. For Automation, the value is the Automation account associated with the runbook.
ResourceGroup Specifies the resource group name of the runbook job.
ResourceProvider Specifies the Azure service that supplies the resources you can deploy and manage. For Automation, the value is Azure Automation.
ResourceType Specifies the resource type in Azure. For Automation, the value is the Automation account associated with the runbook.
resultType The status of the runbook job. Possible values are:
- Started
- Stopped
- Suspended
- Failed
- Succeeded
resultDescription Describes the runbook job result state. Possible values are:
- Job is started
- Job Failed
- Job Completed
RunbookName Specifies the name of the runbook.
SourceSystem Specifies the source system for the data submitted. For Automation, the value is OpsManager
StreamType Specifies the type of event. Possible values are:
- Verbose
- Output
- Error
- Warning
SubscriptionId Specifies the subscription ID of the job.
Time Date and time when the runbook job executed.

Job streams

Property Description
Caller Who initiated the operation. Possible values are either an email address or system for scheduled jobs.
Category Classification of the type of data. For Automation, the value is JobStreams.
JobId GUID that is the ID of the runbook job.
operationName Specifies the type of operation performed in Azure. For Automation, the value is Job.
ResourceGroup Specifies the resource group name of the runbook job.
resourceId Specifies the resource ID in Azure. For Automation, the value is the Automation account associated with the runbook.
ResourceProvider Specifies the Azure service that supplies the resources you can deploy and manage. For Automation, the value is Azure Automation.
ResourceType Specifies the resource type in Azure. For Automation, the value is the Automation account associated with the runbook.
resultType The result of the runbook job at the time the event was generated. A possible value is:
- InProgress
resultDescription Includes the output stream from the runbook.
RunbookName The name of the runbook.
SourceSystem Specifies the source system for the data submitted. For Automation, the value is OpsManager.
StreamType The type of job stream. Possible values are:
- Progress
- Output
- Warning
- Error
- Debug
- Verbose
Time Date and time when the runbook job executed.

When you perform any log search that returns category records of JobLogs or JobStreams, you can select the JobLogs or JobStreams view, which displays a set of tiles summarizing the updates returned by the search.

Sample log searches

The following table provides sample log searches for job records collected by Start/Stop VMs during off-hours.

Query Description
Find jobs for runbook ScheduledStartStop_Parent that have finished successfully search Category == "JobLogs"
| where ( RunbookName_s == "ScheduledStartStop_Parent" )
| where ( ResultType == "Completed" )
| summarize AggregatedValue = count() by ResultType, bin(TimeGenerated, 1h)
| sort by TimeGenerated desc
Find jobs for runbook ScheduledStartStop_Parent that have not completed successfully search Category == "JobLogs"
| where ( RunbookName_s == "ScheduledStartStop_Parent" )
| where ( ResultType == "Failed" )
| summarize AggregatedValue = count() by ResultType, bin(TimeGenerated, 1h)
| sort by TimeGenerated desc
Find jobs for runbook SequencedStartStop_Parent that have finished successfully search Category == "JobLogs"
| where ( RunbookName_s == "SequencedStartStop_Parent" )
| where ( ResultType == "Completed" )
| summarize AggregatedValue = count() by ResultType, bin(TimeGenerated, 1h)
| sort by TimeGenerated desc
Find jobs for runbook SequencedStartStop_Parent that have not completed successfully search Category == "JobLogs"
| where ( RunbookName_s == "SequencedStartStop_Parent" )
| where ( ResultType == "Failed" )
| summarize AggregatedValue = count() by ResultType, bin(TimeGenerated, 1h)
| sort by TimeGenerated desc

Next steps