Description
To investigate MSK connectivity errors or delays, export broker logs to CloudWatch Logs, S3 or Firehose under LoggingInfo.BrokerLogs. Use CloudTrail for calls to the MSK management API.
Potential impact
Without retained broker logs, you may lose the errors recorded during an incident. These logs cover broker operation and cannot trace every message or user action.
Remediation
Create the destination and configure delivery permissions first. For CloudWatch Logs, set CloudWatchLogs.Enabled to true and supply the group name through BrokerLogGroupName. Check for a recent broker log entry, then manage retention, reader access and cost.
Examples
The first excerpt specifies no log destination. For deployment, choose a supported Kafka version and broker type and replace the sample subnet IDs.
Before
AWSTemplateFormatVersion: "2010-09-09"
Description: MSK Cluster with required properties.
Resources:
TestCluster5:
Type: "AWS::MSK::Cluster"
Properties:
ClusterName: ClusterWithRequiredProperties
KafkaVersion: 2.2.1
NumberOfBrokerNodes: 3
BrokerNodeGroupInfo:
InstanceType: kafka.m5.large
ClientSubnets:
- ReplaceWithSubnetId1
- ReplaceWithSubnetId2
- ReplaceWithSubnetId3
After
AWSTemplateFormatVersion: "2010-09-09"
Description: MSK Cluster with required properties.
Resources:
TestCluster5:
Type: "AWS::MSK::Cluster"
Properties:
ClusterName: ClusterWithRequiredProperties
KafkaVersion: 2.2.1
LoggingInfo:
BrokerLogs:
CloudWatchLogs:
Enabled: true
LogGroup: !Ref BrokerLogGroupName
NumberOfBrokerNodes: 3
BrokerNodeGroupInfo:
InstanceType: kafka.m5.large
ClientSubnets:
- ReplaceWithSubnetId1
- ReplaceWithSubnetId2
- ReplaceWithSubnetId3