added diag log policy for search
This commit is contained in:
Родитель
4332b1c0fa
Коммит
805832498d
|
@ -0,0 +1,131 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"policyName": {
|
||||
"value": "DiagnosticSettings-Search-LogAnalytics"
|
||||
},
|
||||
"policyDescription": {
|
||||
"value": "Send diagnostic settings for search to log analytics workspace."
|
||||
},
|
||||
"policyMode": {
|
||||
"value": "All"
|
||||
},
|
||||
"policyParameters": {
|
||||
"value": {
|
||||
"logAnalytics": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"displayName": "Log Analytics workspace",
|
||||
"description": "Select the Log Analytics workspace from the dropdown list",
|
||||
"strongType": "omsWorkspace"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"policyDefinition": {
|
||||
"value": {
|
||||
"if": {
|
||||
"field": "type",
|
||||
"equals": "Microsoft.Search/searchServices"
|
||||
},
|
||||
"then": {
|
||||
"effect": "deployIfNotExists",
|
||||
"details": {
|
||||
"type": "Microsoft.Insights/diagnosticSettings",
|
||||
"name": "setByPolicy",
|
||||
"existenceCondition": {
|
||||
"allOf": [
|
||||
{
|
||||
"field": "Microsoft.Insights/diagnosticSettings/logs.enabled",
|
||||
"equals": "true"
|
||||
},
|
||||
{
|
||||
"field": "Microsoft.Insights/diagnosticSettings/metrics.enabled",
|
||||
"equals": "true"
|
||||
},
|
||||
{
|
||||
"field": "Microsoft.Insights/diagnosticSettings/workspaceId",
|
||||
"equals": "[parameters('logAnalytics')]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"roleDefinitionIds": [
|
||||
"/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
|
||||
],
|
||||
"deployment": {
|
||||
"properties": {
|
||||
"mode": "incremental",
|
||||
"template": {
|
||||
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"resourceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"logAnalytics": {
|
||||
"type": "string"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"variables": {},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Search/searchServices/providers/diagnosticSettings",
|
||||
"apiVersion": "2017-05-01-preview",
|
||||
"name": "[concat(parameters('resourceName'), '/', 'Microsoft.Insights/setByPolicy')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [],
|
||||
"properties": {
|
||||
"workspaceId": "[parameters('logAnalytics')]",
|
||||
"metrics": [
|
||||
{
|
||||
"category": "AllMetrics",
|
||||
"enabled": true,
|
||||
"retentionPolicy": {
|
||||
"days": 0,
|
||||
"enabled": false
|
||||
},
|
||||
"timeGrain": null
|
||||
}
|
||||
],
|
||||
"logs": [
|
||||
{
|
||||
"category": "OperationLogs",
|
||||
"enabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {}
|
||||
},
|
||||
"parameters": {
|
||||
"logAnalytics": {
|
||||
"value": "[parameters('logAnalytics')]"
|
||||
},
|
||||
"location": {
|
||||
"value": "[field('location')]"
|
||||
},
|
||||
"resourceName": {
|
||||
"value": "[field('name')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"policyMetadata": {
|
||||
"value": {
|
||||
"version": "1.0.0",
|
||||
"category": "Search",
|
||||
"preview": false,
|
||||
"deprecated": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче