简体   繁体   中英

Azure Gateway ARM template to configure diagnostic setting (Log Analytics workspace)

I am looking for ARM template that will help to configure (Log Analytics) diagnostic setting. Have search few templates but no hope. Tried by export template and also with Resource Explorer didn't find the diagnostic setting configurations. Please share your idea

Here is the ARM template which i am trying

"apiVersion": "2015-07-01",
         "name": "[concat(parameters('applicationGateways_name'), '/Microsoft.Insights/service')]",
         "type": "Microsoft.Network/applicationGateways/providers/diagnosticsettings",
         "location": "[resourceGroup().location]",
          "dependsOn": [
            "[concat('Microsoft.Network/ApplicationGateways/', parameters('applicationGateways_name'))]"
          ],
          "properties":{
            "name":"DiagService",
            "workspaceId":"[variables('workspaceId')]",
            "logs":[
               {

Where as for "type": "Microsoft.Network/applicationGateways/providers/diagnosticsettings" not deducting

I am trying to add in the existing workspace

it worked with the following changes

{
   "apiVersion": "2017-05-01-preview",
   "name": "[concat(parameters('applicationGatewayName'), '/Microsoft.Insights/diagnosticSettings')]",
   "type":"Microsoft.Network/applicationGateways/providers/diagnosticSettings",
   "location": "[resourceGroup().location]",
   "dependsOn": [
        "[concat('Microsoft.Network/ApplicationGateways/', parameters('applicationGatewayName'))]"
      ],
      "properties":{
        "name":"Diag",
        "workspaceId":  "[concat('/subscriptions/', subscription().subscriptionId,  '/resourceGroups/', resourceGroup().name, '/providers/microsoft.operationalinsights/workspaces/', parameters('workspaceId'))]",


        "logs":[
           {
             "category": "ApplicationGatewayAccessLog",
             "enabled": true,
             "retentionPolicy": {
             "enabled": false,
             "days": 0
                                }
           },
           {
              "category": "ApplicationGatewayPerformanceLog",
              "enabled": true,
              "retentionPolicy": {
                "days": 0,
                "enabled": false
              }
            },
            {
              "category": "ApplicationGatewayFirewallLog",
              "enabled": true,
              "retentionPolicy": {
                "days": 0,
                "enabled": false
              }
            }
                ],
                "metrics": [
            {
              "category": "AllMetrics",
              "enabled": true,
              "retentionPolicy": {
                "enabled": false,
                "days": 0
              }
            }
          ]
                    }
  }

Please NOTE Here I have used common workspace which created earlier

The ARM template is missing what kind of logs/metrics to send to the workspace. Try adding this in your section:

   "logs": [
      {
        "category": "ApplicationGatewayAccessLog",
        "enabled": true,
        "retentionPolicy": {
          "enabled": false,
          "days": 0
        }
      },
      {
        "category": "ApplicationGatewayPerformanceLog",
        "enabled": true,
        "retentionPolicy": {
          "enabled": false,
          "days": 0
        }
      },
      {
        "category": "ApplicationGatewayFirewallLog",
        "enabled": true,
        "retentionPolicy": {
          "enabled": false,
          "days": 0
        }
      }
    ],
    "metrics": [
      {
        "category": "AllMetrics",
        "timeGrain": "PT1M",
        "enabled": true,
        "retentionPolicy": {
          "enabled": false,
          "days": 0
        }

      }
    ]

Edit the retention as needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM