Rajakumar Babu
Rajakumar Babu

Reputation: 117

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

Upvotes: 1

Views: 1878

Answers (2)

Rajakumar Babu
Rajakumar Babu

Reputation: 117

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

Upvotes: 3

DreadedFrost
DreadedFrost

Reputation: 2978

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.

Upvotes: 0

Related Questions