Skip to content

Commit

Permalink
eventgrid: add support for shipping audit logs to log analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
jfchevrette committed Feb 27, 2025
1 parent dee4e44 commit 74ba00e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
41 changes: 41 additions & 0 deletions dev-infrastructure/modules/maestro/maestro-infra.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ param maxClientSessionsPerAuthName int
])
param publicNetworkAccess string

@description('Log Analytics Workspace ID if logging to Log Analytics')
param logAnalyticsWorkspaceId string = ''

param certificateIssuer string

//
Expand Down Expand Up @@ -53,6 +56,44 @@ resource eventGridNamespace 'Microsoft.EventGrid/namespaces@2024-12-15-preview'
}
}

resource eventGridNamespaceDiagnostics 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = if (logAnalyticsWorkspaceId != '') {
scope: eventGridNamespace
name: eventGridNamespaceName
properties: {
logs: [
{
category: 'SuccessfulMqttConnections'
enabled: true
}
{
category: 'FailedMqttConnections'
enabled: true
}
{
category: 'MqttDisconnections'
enabled: true
}
{
category: 'FailedMqttPublishedMessages'
enabled: true
}
{
category: 'FailedMqttSubscriptionOperations'
enabled: true
}
{
category: 'SuccessfulHttpDataPlaneOperations'
enabled: true
}
{
category: 'FailedHttpDataPlaneOperations'
enabled: true
}
]
workspaceId: logAnalyticsWorkspaceId
}
}

// find a better way to register the OneCert
resource certificateSignerCA 'Microsoft.EventGrid/namespaces/caCertificates@2024-12-15-preview' = if (startsWith(
certificateIssuer,
Expand Down
1 change: 1 addition & 0 deletions dev-infrastructure/templates/region.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ module maestroInfra '../modules/maestro/maestro-infra.bicep' = {
maxClientSessionsPerAuthName: maestroEventGridMaxClientSessionsPerAuthName
publicNetworkAccess: maestroEventGridPrivate ? 'Disabled' : 'Enabled'
certificateIssuer: maestroCertificateIssuer
logAnalyticsWorkspaceId: logAnalyticsWorkspace.id
}
}

Expand Down

0 comments on commit 74ba00e

Please sign in to comment.