https://kafka.apache.org/documentation/#brokerconfigs indicates that log.dirs defaults to null/empty, so log.dir wins.
Name | Description | Type | Default | Valid Values | Importance | Dynamic Update Mode
-- | -- | -- | -- | -- | -- | --
log.dir | The directory in which the log data is kept (supplemental for log.dirs property) | string | /tmp/kafka-logs | 聽 | high | read-only
log.dirs | The directories in which the log data is kept. If not set, the value in log.dir is used | string | null | 聽 | high | read-only
KAFKA_LOG_DIR is not used anywhere in the bootstrapping code. Meanwhile, the bootstrapping code defaults KAFKA_LOG_DIRS to /var/lib/kafka/data.
As I user, I set KAFKA_LOG_DIR to /foo and leave KAFKA_LOG_DIRS unset; when Kafka starts, I expect it to write all data to /foo. Due to the behavior explained above, this scenario leads Kafka to write to /var/lib/kafka/data.
Separately, KAFKA_DATA_DIRS appears to be a legacy concept which adds confusion.
PROPOSAL:
Determine where to write logs per:

If the above looks good, I'm happy to open a PR to adjust the bash. Please confirm whether to keep Confluent's default path of /var/lib/kafka/data or revert to Apache Kafka default of /tmp/kafka-logs.
Whichever value is used to specify where Kafka will write the file, check it using dub path <path> writable. Remove KAFKA_DATA_DIRS all together.
@ybyzek ... if the above sounds reasonable, I'm happy to work on a PR. What do you think?
Regarding KAFKA_DATA_DIRS it seems one day it was corrected but something happend to this repo. #184
I'm agree with you it's confusing.
Most helpful comment
Regarding KAFKA_DATA_DIRS it seems one day it was corrected but something happend to this repo. #184
I'm agree with you it's confusing.