This template creates a data collection rule defining the data source (Syslog) and the destination workspace.
{"scope": "[format('microsoft.apimanagement/service/{0}", variables('apim-name'))]", "type": "microsoft.insights/diagnosticsettings", "apiversion": "2017-05-01-preview", "name": "logtoanalytics", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.apimanagement/service", variables('apim-name'))]"], "properties": {"workspaceid": "[parameters('log-analytics-workspace-id')]", "logs": [{"category": "gatewaylogs", "enabled": true}], "metrics": [{"category": "allmetrics", "enabled": true}]}}{"scope": "[format('microsoft.network/applicationgateways/{0}", variables('app-gateway-name'))]", "type": "microsoft.insights/diagnosticsettings", "apiversion": "2017-05-01-preview", "name": "logtoanalytics", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/applicationgateways", variables('app-gateway-name'))]"], "properties": {"workspaceid": "[parameters('log-analytics-workspace-id')]", "logs": [{"category": "applicationgatewayaccesslog", "enabled": true}, {"category": "applicationgatewayperformancelog", "enabled": true}, {"category": "applicationgatewayfirewalllog", "enabled": true}], "metrics": [{"category": "allmetrics", "enabled": true}]}}{"type": "microsoft.insights/components", "apiversion": "2020-02-02-preview", "name": "[variables('app-insights-name')]", "location": "[parameters('location')]", "kind": "web", "properties": {"application_type": "web", "workspaceresourceid": "[parameters('log-analytics-workspace-id')]"}} 