Managing Apache KafkaPDF version

Broker garbage collection log configuration

Learn more about broker garbage collection and how garbage collection log rotation can be configured.

Both broker JVM garbage collection log and JVM garbage collection log rotation is enabled by default in the Kafka version delivered with Runtime. Garbage collection logs are written in the agent process directory by default.

Example path:
/run/cloudera-scm-agent/process/99-kafka-KAFKA_BROKER/kafkaServer-gc.log

Changing the default directory of garbage collection logs is currently not supported. However, you can configure properties related garbage collection log rotation.

Garbage collection log rotation properties can be configured with the Kafka Broker Environment Advanced Configuration Snippet (Safety Valve) property.

  1. In Cloudera Manager, go to the Kafka service and click Configuration.
  2. Find the Kafka Broker Environment Advanced Configuration Snippet (Safety Valve) property.
  3. Add the following line to the property:

    Modify the values of as required.

    KAFKA_GC_LOG_OPTS="-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
    
    The flags used are as follows:
    • +UseGCLogFileRotation: Enables garbage collection log rotation.
    • -XX:NumberOfGCLogFiles: Specifies the number of files to use when rotating logs.
    • -XX:GCLogFileSize: Specifies the size when the log will be rotated.
  4. Click on Save Changes.
  5. Restart the Kafka service to apply the changes.
Kafka garbage collection log rotation is configured.