Kafka Broker KafkaHighLogRetentionSize
The log retention size is higher than expected, affecting broker performance.
Debug kafka-broker automatically with DrDroid AI →
Connect your tools and ask AI to solve it for you
Understanding Kafka Broker
Apache Kafka is a distributed event streaming platform used for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications. Kafka brokers are the heart of the Kafka cluster, responsible for receiving, storing, and forwarding messages to consumers. They manage the storage of messages on disk and ensure data durability and availability.
Symptom: KafkaHighLogRetentionSize
The KafkaHighLogRetentionSize alert is triggered when the log retention size exceeds a predefined threshold. This can lead to performance degradation and potential data loss if not addressed promptly.
Details About the Alert
The alert indicates that the size of the logs retained on the Kafka broker has grown beyond the expected limit. This can occur due to insufficient log cleanup, misconfigured retention policies, or unexpected spikes in data volume. High log retention size can lead to increased disk usage, slower read/write operations, and potential broker instability.
Impact of High Log Retention Size
When the log retention size is too high, it can consume excessive disk space, leading to potential out-of-space errors. It can also slow down log segment operations, affecting the overall throughput and latency of the Kafka cluster.
Steps to Fix the Alert
1. Review and Optimize Log Retention Policies
Check the current log retention settings using the following command:
kafka-configs --bootstrap-server <broker-address> --entity-type topics --describe
Look for the retention.bytes and retention.ms configurations. Adjust these settings to align with your data retention requirements. For example, to set a retention size of 10GB, use:
kafka-configs --bootstrap-server <broker-address> --entity-type topics --entity-name <topic-name> --alter --add-config retention.bytes=10737418240
2. Monitor Log Retention Size
Regularly monitor the log retention size using Prometheus and Grafana dashboards. Set up alerts to notify you when the log size approaches critical thresholds. This proactive monitoring helps in taking timely actions to prevent issues.
3. Increase Disk Capacity
If optimizing retention policies is not sufficient, consider increasing the disk capacity of your Kafka brokers. This can be done by adding more disks or expanding existing storage volumes. Ensure that the new storage is properly configured and integrated with your Kafka setup.
4. Clean Up Old Logs
Manually delete old log segments if necessary. Use the following command to force log cleanup:
kafka-log-dirs --bootstrap-server <broker-address> --describe
Identify the log directories and remove old segments that are no longer needed. Be cautious when performing manual deletions to avoid data loss.
Additional Resources
- Apache Kafka Documentation - Official documentation for Kafka configuration and management.
- Prometheus Documentation - Learn more about setting up and using Prometheus for monitoring Kafka.
- Grafana Documentation - Explore Grafana dashboards for visualizing Kafka metrics.
Frequently asked questions
What causes KafkaHighLogRetentionSize? +
The log retention size is higher than expected, affecting broker performance.
Still debugging? Let DrDroid AI investigate for you →
Connect your tools and debug with AI
Get root cause analysis in minutes
- Connect your existing monitoring tools
- Ask AI to debug issues automatically
- Get root cause analysis in minutes