For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/cloudformation-aws-msk-cluster-logging-disabled.md.
A documentation index is available at /llms.txt.
MSK clusters must have broker logging enabled to provide audit and operational visibility. Without broker logs, you may be unable to detect or investigate security incidents, troubleshoot cluster issues, or meet logging retention and compliance requirements. In AWS CloudFormation, the AWS::MSK::Cluster resource must include the LoggingInfo property with BrokerLogs configured to specify at least one destination (CloudWatchLogs, Firehose, or S3). The selected destination entry must have Enabled set to true. Resources missing LoggingInfo, missing all three broker log destinations, or where none of the BrokerLogs entries have Enabled set to true will be flagged.
Secure configuration example (CloudFormation YAML):
AWSTemplateFormatVersion:"2010-09-09"Description:MSK Cluster with required properties.Resources:TestCluster:Type:'AWS::MSK::Cluster'Properties:ClusterName:ClusterWithRequiredPropertiesKafkaVersion:2.2.1LoggingInfo:BrokerLogs:CloudWatchLogs:Enabled:trueLogGroup:aws_cloudwatch_log_group.test.nameNumberOfBrokerNodes:3BrokerNodeGroupInfo:InstanceType:kafka.m5.largeClientSubnets:- ReplaceWithSubnetId1- ReplaceWithSubnetId2- ReplaceWithSubnetId3
AWSTemplateFormatVersion:"2010-09-09"Description:MSK Cluster with required properties.Resources:TestCluster2:Type:'AWS::MSK::Cluster'Properties:ClusterName:ClusterWithRequiredPropertiesKafkaVersion:2.2.1LoggingInfo:BrokerLogs:CloudWatchLogs:Enabled:falseLogGroup:aws_cloudwatch_log_group.test.nameS3:Enabled:trueLogGroup:s3.test.nameNumberOfBrokerNodes:3BrokerNodeGroupInfo:InstanceType:kafka.m5.largeClientSubnets:- ReplaceWithSubnetId1- ReplaceWithSubnetId2- ReplaceWithSubnetId3
{"AWSTemplateFormatVersion":"2010-09-09","Description":"MSK Cluster with required properties.","Resources":{"TestCluster3":{"Type":"AWS::MSK::Cluster","Properties":{"ClusterName":"ClusterWithRequiredProperties","KafkaVersion":"2.2.1","LoggingInfo":{"BrokerLogs":{"CloudWatchLogs":{"Enabled":true,"LogGroup":"aws_cloudwatch_log_group.test.name"}}},"NumberOfBrokerNodes":3,"BrokerNodeGroupInfo":{"InstanceType":"kafka.m5.large","ClientSubnets":["ReplaceWithSubnetId1","ReplaceWithSubnetId2","ReplaceWithSubnetId3"]}}}}}
Non-Compliant Code Examples
AWSTemplateFormatVersion:"2010-09-09"Description:MSK Cluster with required properties.Resources:TestCluster5:Type:'AWS::MSK::Cluster'Properties:ClusterName:ClusterWithRequiredPropertiesKafkaVersion:2.2.1NumberOfBrokerNodes:3BrokerNodeGroupInfo:InstanceType:kafka.m5.largeClientSubnets:- ReplaceWithSubnetId1- ReplaceWithSubnetId2- ReplaceWithSubnetId3
AWSTemplateFormatVersion:"2010-09-09"Description:MSK Cluster with required properties.Resources:TestCluster6:Type:'AWS::MSK::Cluster'Properties:ClusterName:ClusterWithRequiredPropertiesKafkaVersion:2.2.1LoggingInfo:BrokerLogs:CloudWatchLogs:Enabled:falseLogGroup:aws_cloudwatch_log_group.test.nameFirehose:Enabled:falseLogGroup:firehose.test.nameS3:Enabled:falseLogGroup:s3.test.nameNumberOfBrokerNodes:3BrokerNodeGroupInfo:InstanceType:kafka.m5.largeClientSubnets:- ReplaceWithSubnetId1- ReplaceWithSubnetId2- ReplaceWithSubnetId3
AWSTemplateFormatVersion:"2010-09-09"Description:MSK Cluster with required properties.Resources:TestCluster7:Type:'AWS::MSK::Cluster'Properties:ClusterName:ClusterWithRequiredPropertiesKafkaVersion:2.2.1LoggingInfo:BrokerLogs:CloudWatchLogs:Enabled:falseLogGroup:aws_cloudwatch_log_group.test.nameNumberOfBrokerNodes:3BrokerNodeGroupInfo:InstanceType:kafka.m5.largeClientSubnets:- ReplaceWithSubnetId1- ReplaceWithSubnetId2- ReplaceWithSubnetId3
1
2
rulesets:- CloudFormation / AWS # Rules to enforce / AWS.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.