Skip to content

Commit

Permalink
aks-cluster: add support for enabling pod logs collection
Browse files Browse the repository at this point in the history
  • Loading branch information
jfchevrette committed Feb 24, 2025
1 parent c55bc6c commit bea4e40
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions dev-infrastructure/modules/aks-cluster-base.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,63 @@ resource aksDiagnosticSettings 'Microsoft.Insights/diagnosticSettings@2017-05-01
}
}

resource aksClusterDcr 'Microsoft.Insights/dataCollectionRules@2023-03-11' = if (logAnalyticsWorkspaceId != '') {
name: '${aksClusterName}-dcr'
location: location
kind: 'Linux'
properties: {
dataSources: {
extensions: [
{
name: 'ContainerInsightsExtension'
streams: [
'Microsoft-ContainerLog'
'Microsoft-ContainerLogV2'
'Microsoft-KubeEvents'
'Microsoft-KubePodInventory'
]
extensionSettings: {
dataCollectionSettings: {
interval: '1m'
namespaceFilteringMode: 'Off'
enableContainerLogV2: true
}
}
extensionName: 'ContainerInsights'
}
]
}
destinations: {
logAnalytics: [
{
name: 'ciworkspace'
workspaceResourceId: logAnalyticsWorkspaceId
}
]
}
dataFlows: [
{
destinations: [
'ciworkspace'
]
streams: [
'Microsoft-ContainerLog'
'Microsoft-ContainerLogV2'
'Microsoft-KubeEvents'
]
}
]
}
}

resource aksClusterDcra 'Microsoft.Insights/dataCollectionRuleAssociations@2023-03-11' = if (logAnalyticsWorkspaceId != '') {
name: '${aksClusterName}-dcra'
scope: aksCluster
properties: {
description: 'Association of data collection rule. Deleting this association will break the data collection for this AKS Cluster.'
dataCollectionRuleId: aksClusterDcr.id
}
}

resource userAgentPools 'Microsoft.ContainerService/managedClusters/agentPools@2024-04-02-preview' = [
for i in range(0, userAgentPoolAZCount): {
Expand Down

0 comments on commit bea4e40

Please sign in to comment.