All log files are included in the upstream log4j.properties, but kafkaServer-gc.log.* is missing. In our installation we see these files being accumulated:
root@<pod>:/var/log/kafka$ ls -la
total 789020
drwxr-x--- 2 cp-kafka confluent 238 Jul 8 22:50 .
drwxr-xr-x 6 root root 166 May 24 00:38 ..
-rw-r--r-- 1 root root 104858254 Jul 4 08:25 kafkaServer-gc.log.0
-rw-r--r-- 1 root root 104857828 Jul 5 03:07 kafkaServer-gc.log.1
-rw-r--r-- 1 root root 104857844 Jul 5 21:34 kafkaServer-gc.log.2
-rw-r--r-- 1 root root 104858475 Jul 6 15:58 kafkaServer-gc.log.3
-rw-r--r-- 1 root root 104859142 Jul 7 10:15 kafkaServer-gc.log.4
-rw-r--r-- 1 root root 104857893 Jul 8 04:32 kafkaServer-gc.log.5
-rw-r--r-- 1 root root 104858204 Jul 8 22:50 kafkaServer-gc.log.6
-rw-r--r-- 1 root root 45897083 Jul 9 06:50 kafkaServer-gc.log.7.current
So, why do we log this? The confluent image script does not seem to include GC logging:
The relevant arguments of the current command-line are:
-Xloggc:/var/log/kafka/kafkaServer-gc.log
-verbose:gc
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=100M
The /usr/bin/kafka-run-class script currently in this container comes from upstream Kafka. The confluent image is running on Java 1.8 - so line 284 will be the one:
We actually check for the existence of a -loggc argument, which I cannot find in the image:
And only if ${GC_LOG_ENABLED} is true, we actually append the configuration:
So, my question is: Why are these arguments appended? How can we disable them?
Any update on this? I, too, am running into this issue.
From taking a look at bin/kafka-run-class.sh, it seems that if the environment variable KAFKA_GC_LOG_OPTS is defined, then it is used instead of the command-line arguments mentioned above (i.e. -Xloggc:/var/log/kafka/kafkaServer-gc.log -verbose:gc ...). So setting it to an "innocent" value will stop verbose GC logging. I use:
export KAFKA_GC_LOG_OPTS=-Dnogclog
Of course this is only a workaround.
Most helpful comment
From taking a look at
bin/kafka-run-class.sh, it seems that if the environment variableKAFKA_GC_LOG_OPTSis defined, then it is used instead of the command-line arguments mentioned above (i.e.-Xloggc:/var/log/kafka/kafkaServer-gc.log -verbose:gc ...). So setting it to an "innocent" value will stop verbose GC logging. I use:Of course this is only a workaround.