Diagnostic settings in autoscale
Autoscale has two log categories and a set of metrics that can be enabled via the Diagnostics settings tab on the Autoscale setting page.
The two categories are:
- Autoscale Evaluations contain log data relating to rule evaluation.
- Autoscale Scale Actions log data relating to each scale event.
For more information about autoscale metrics, see the Supported metrics document.
You can send logs and metrics to various destinations:
- Log Analytics workspaces
- Storage accounts
- Event hubs
- Partner solutions
For more information on diagnostics, see Diagnostic settings in Azure Monitor.
View the history of your autoscale activity on the Run history tab. The Run history tab includes a chart of resource instance counts over time and the resource activity log entries for autoscale.
The following examples are the general formats for autoscale resource logs with example data included. Not all the examples are properly formed JSON because they might include a valid list for a given field.
Use these logs to troubleshoot issues in autoscale. For more information, see Troubleshooting autoscale problems.
Note
Although the logs may refer to "scale up" and "scale down" actions, the actual action taken is scale in or scale out.
The following schemas appear in the autoscale evaluations log.
Logged when autoscale first looks at an autoscale profile:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": ["FixedDateProfileEvaluation", "RecurrentProfileEvaluation", "DefaultProfileEvaluation"],
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"profile": "defaultProfile",
"profileSelected": [true, false]
}
}
Logged when autoscale evaluates if it shouldn't scale because of a cool-down period:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "ScaleRuleCooldownEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"selectedProfile": "defaultProfile",
"scaleDirection": ["Increase", "Decrease"]
"lastScaleActionTime": "2018-09-10 18:08:00.6132593",
"cooldown": "00:30:00",
"evaluationTime": "2018-09-10 18:11:00.6132593",
"skipRuleEvaluationForCooldown": true
}
}
Logged when autoscale first starts evaluating a particular scale rule:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "ScaleRuleEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"metricName": "Percentage CPU",
"metricNamespace": "",
"timeGrain": "00:01:00",
"timeGrainStatistic": "Average",
"timeWindow": "00:10:00",
"timeAggregationType": "Average",
"operator": "GreaterThan",
"threshold": 70,
"observedValue": 25,
"estimateScaleResult": ["Triggered", "NotTriggered", "Unknown"]
}
}
Logged when autoscale evaluates the metric being used to trigger a scale action:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "MetricEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"metricName": "Percentage CPU",
"metricNamespace": "",
"timeGrain": "00:01:00",
"timeGrainStatistic": "Average",
"startTime": "2018-09-10 18:00:00.43833793",
"endTime": "2018-09-10 18:10:00.43833793",
"data": [0.33333333333333331,0.16666666666666666,1.0,0.33333333333333331,2.0,0.16666666666666666,9.5]
}
}
Logged when autoscale evaluates the number of instances already running in preparation for deciding if it should start more, shut down some, or do nothing:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "InstanceCountEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"currentInstanceCount": 20,
"minimumInstanceCount": 15,
"maximumInstanceCount": 30,
"defaultInstanceCount": 20
}
}
Logged when autoscale starts evaluation if a scale action should take place:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "ScaleActionOperationEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"lastScaleActionOperationId": "2222cccc-33dd-eeee-ff44-aaaaaa555555",
"lastScaleActionOperationStatus": ["InProgress", "Timeout"]
"skipCurrentAutoscaleEvaluation": [true, false]
}
}
Logged when autoscale updates the number of compute instances running, either up or down:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "InstanceUpdateEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"currentInstanceCount": 20,
"newInstanceCount": 21,
"shouldUpdateInstance": [true, false],
"reason": ["Scale down action triggered", "Scale up to default instance count", ...]
}
}
The following schemas appear in the autoscale evaluations log.
Logged when autoscale initiates a scale action, either up or down:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "InstanceScaleAction",
"category": "AutoscaleScaleActions",
"resultType": ["Succeeded", "InProgress", "Failed"],
"resultDescription": ["Create async operation job failed", ...]
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"currentInstanceCount": 20,
"newInstanceCount": 21,
"scaleDirection": ["Increase", "Decrease"],
["createdAsyncScaleActionJob": [true, false],]
["createdAsyncScaleActionJobId": "378ejr-7yye-892d-17dd-92ndijfe1738",]
}
}
Logged at different intervals of an instance scale action:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "InstanceScaleAction",
"category": "AutoscaleScaleActions",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"scaleActionOperationId": "378ejr-7yye-892d-17dd-92ndijfe1738",
"scaleActionOperationStatus": ["InProgress", "Timeout", "Canceled", ...],
"scaleActionMessage": ["Scale action is inprogress", ...]
}
}
The following events are logged to the activity log with a CategoryValue
of Autoscale
:
- Autoscale scale-up initiated
- Autoscale scale-up completed
- Autoscale scale-down initiated
- Autoscale scale-down completed
- Predictive autoscale scale-up initiated
- Predictive autoscale scale-up completed
- Metric failure
- Metric recovery
- Predictive metric failure
- Flapping
An extract of each log event name, showing the relevant parts of the Properties
element, are shown next.
Logged when autoscale attempts to scale in or out:
{
"eventCategory": "Autoscale",
"eventName": "AutoscaleAction",
...
"eventProperties": "{
"Description": "The autoscale engine attempting to scale resource '/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan' from 2 instances count to 1 instancescount.",
"ResourceName": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"OldInstancesCount": 2,
"NewInstancesCount": 1,
"ActiveAutoscaleProfile": {
"Name": "Default scale condition",
"Capacity": {
"Minimum": "1",
"Maximum": "5",
"Default": "1"
},
"Rules": [
{
"MetricTrigger": {
"Name": "CpuPercentage",
"Namespace": "microsoft.web/serverfarms",
"Resource": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"ResourceLocation": "China North",
"TimeGrain": "PT1M",
"Statistic": "Average",
"TimeWindow": "PT2M",
"TimeAggregation": "Average",
"Operator": "GreaterThan",
"Threshold": 40.0,
"Source": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"MetricType": "MDM",
"Dimensions": [],
"DividePerInstance": false
},
"ScaleAction": {
"Direction": "Increase",
"Type": "ChangeCount",
"Value": "1",
"Cooldown": "PT3M"
}
},
{
"MetricTrigger": {
"Name": "CpuPercentage",
"Namespace": "microsoft.web/serverfarms",
"Resource": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"ResourceLocation": "China North",
"TimeGrain": "PT1M",
"Statistic": "Average",
"TimeWindow": "PT5M",
"TimeAggregation": "Average",
"Operator": "LessThanOrEqual",
"Threshold": 30.0,
"Source": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"MetricType": "MDM",
"Dimensions": [],
"DividePerInstance": false
},
"ScaleAction": {
"Direction": "Decrease",
"Type": "ExactCount",
"Value": "1",
"Cooldown": "PT5M"
}
}
]
},
"LastScaleActionTime": "Thu, 26 Jan 2023 12:57:14 GMT"
}",
...
"activityStatusValue": "Succeeded"
}
Logged following a scale event:
"Properties":{
"eventCategory": "Autoscale",
"eventName": "GetOperationStatusResult",
...
"eventProperties": "{"OldInstancesCount":3,"NewInstancesCount":2}",
...
"activityStatusValue": "Succeeded"
}
Logged when autoscale can't determine the value of the metric used in the scale rule:
"Properties":{
"eventCategory": "Autoscale",
"eventName": "MetricFailure",
...
"eventProperties": "{
"Notes":"To ensure service availability, Autoscale will scale out the resource to the default capacity if it is greater than the current capacity}",
...
"activityStatusValue": "Failed"
}
Logged when autoscale can once again determine the value of the metric used in the scale rule after a MetricFailure
event:
"Properties":{
"eventCategory": "Autoscale",
"eventName": "MetricRecovery",
...
"eventProperties": "{}",
...
"activityStatusValue": "Succeeded"
}
Logged when autoscale can't calculate predicted scale events because the metric is unavailable:
"Properties": {
"eventCategory": "Autoscale",
"eventName": "PredictiveMetricFailure",
...
"eventProperties": "{
"Notes": "To ensure service availability, Autoscale will scale out the resource to the default capacity if it is greater than the current capacity"
}",
...
"activityStatusValue": "Failed"
}
Logged when autoscale detects flapping could occur and scales differently to avoid it:
"Properties":{
"eventCategory": "Autoscale",
"eventName": "FlappingOccurred",
...
"eventProperties":
"{"Description":"Scale down will occur with updated instance count to avoid flapping.
Resource: '/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan'.
Current instance count: '6',
Intended new instance count: '1'.
Actual new instance count: '4'",
"ResourceName":"/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"OldInstancesCount":6,
"NewInstancesCount":4,
"ActiveAutoscaleProfile":{"Name":"Auto created scale condition",
"Capacity":{"Minimum":"1","Maximum":"30","Default":"1"},
"Rules":[{"MetricTrigger":{"Name":"Requests","Namespace":"microsoft.web/sites","Resource":"/subscriptions/ bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/sites/ScaleableWebApp1", "ResourceLocation":"China North","TimeGrain":"PT1M","Statistic":"Average","TimeWindow":"PT1M","TimeAggregation":"Maximum", "Operator":"GreaterThanOrEqual","Threshold":3.0,"Source":"/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/ rg-001/providers/Microsoft.Web/sites/ScaleableWebApp1","MetricType":"MDM","Dimensions":[],"DividePerInstance":true}, "ScaleAction":{"Direction":"Increase","Type":"ChangeCount","Value":"10","Cooldown":"PT1M"}},{"MetricTrigger":{"Name":"Requests", "Namespace":"microsoft.web/sites","Resource":"/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/ providers/Microsoft.Web/sites/ScaleableWebApp1","ResourceLocation":"China North","TimeGrain":"PT1M","Statistic":"Max", "TimeWindow":"PT1M","TimeAggregation":"Maximum","Operator":"LessThan","Threshold":3.0,"Source":"/subscriptions/ bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/sites/ScaleableWebApp1","MetricType":"MDM", "Dimensions":[],"DividePerInstance":true},"ScaleAction":{"Direction":"Decrease","Type":"ChangeCount","Value":"5", "Cooldown":"PT1M"}}]}}",
...
"activityStatusValue": "Succeeded"
}
Logged when autoscale detects flapping could occur and defers scaling in to avoid it:
"Properties": {
"eventCategory": "Autoscale",
"eventName": "Flapping",
"Description": "{"Cannot scale down due to flapping observed. Resource: '/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Compute/virtualMachineScaleSets/mac2'. Current instance count: '2', Intended new instance count '1'",
"ResourceName": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Compute/virtualMachineScaleSets/mac2",
"OldInstancesCount": "2",
"NewInstancesCount": "2",
"ActiveAutoscaleProfile": "ActiveAutoscaleProfile": {
"Name": "Auto created default scale condition",
"Capacity": {
"Minimum": "1",
"Maximum": "2",
"Default": "1"
},
"Rules": [
{
"MetricTrigger": {
"Name": "StorageSuccesses",
"Namespace": "monitoringbackgroundjob",
"Resource": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/microsoft.monitor/accounts/MACAzureInsightsPROD",
"ResourceLocation": "ChinaNorth2",
"TimeGrain": "PT1M",
"Statistic": "Average",
"TimeWindow": "PT10M",
"TimeAggregation": "Average",
"Operator": "LessThan",
"Threshold": 600.0,
"Source": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/microsoft.monitor/accounts/MACAzureInsightsPROD",
"MetricType": "MDM",
"Dimensions": [],
"DividePerInstance": false
},
"ScaleAction": {
"Direction": "Decrease",
"Type": "ChangeCount",
"Value": "1",
"Cooldown": "PT5M"
}
},
{
"MetricTrigger": {
"Name": "TimeToStartupInMs",
"Namespace": "armrpclient",
"Resource": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-123/providers/microsoft.monitor/accounts/MACMetricsRP",
"ResourceLocation": "chinanorth2",
"TimeGrain": "PT1M",
"Statistic": "Percentile99th",
"TimeWindow": "PT10M",
"TimeAggregation": "Average",
"Operator": "GreaterThan",
"Threshold": 70.0,
"Source": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-123/providers/microsoft.monitor/accounts/MACMetricsRP",
"MetricType": "MDM",
"Dimensions": [],
"DividePerInstance": false
},
"ScaleAction": {
"Direction": "Increase",
"Type": "ChangeCount",
"Value": "1",
"Cooldown": "PT5M"
}
}
]
}"
}...