generated from pamelafox/icon-writer-function
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from pamelafox/appdiagnostics
Adding app diagnostics
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
param appName string = '' | ||
|
||
@description('The kind of the app.') | ||
@allowed([ | ||
'functionapp' | ||
'webapp' | ||
]) | ||
param kind string | ||
|
||
@description('Resource ID of log analytics workspace.') | ||
param diagnosticWorkspaceId string | ||
|
||
param diagnosticLogCategoriesToEnable array = kind == 'functionapp' ? [ | ||
'FunctionAppLogs' | ||
] : [ | ||
'AppServiceHTTPLogs' | ||
'AppServiceConsoleLogs' | ||
'AppServiceAppLogs' | ||
'AppServiceAuditLogs' | ||
'AppServiceIPSecAuditLogs' | ||
'AppServicePlatformLogs' | ||
] | ||
|
||
@description('Optional. The name of metrics that will be streamed.') | ||
@allowed([ | ||
'AllMetrics' | ||
]) | ||
param diagnosticMetricsToEnable array = [ | ||
'AllMetrics' | ||
] | ||
|
||
|
||
var diagnosticsLogs = [for category in diagnosticLogCategoriesToEnable: { | ||
category: category | ||
enabled: true | ||
}] | ||
|
||
var diagnosticsMetrics = [for metric in diagnosticMetricsToEnable: { | ||
category: metric | ||
timeGrain: null | ||
enabled: true | ||
}] | ||
|
||
resource app 'Microsoft.Web/sites@2022-03-01' existing = { | ||
name: appName | ||
} | ||
|
||
resource app_diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = { | ||
name: '${appName}-diagnostics' | ||
scope: app | ||
properties: { | ||
workspaceId: diagnosticWorkspaceId | ||
metrics: diagnosticsMetrics | ||
logs: diagnosticsLogs | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters