3

I am running Confluent's kafka-avro-console-consumer as described in the quickstart tutorial:

kafka-avro-console-consumer --topic test --zookeeper localhost:2181 --from-beginning

However, I have created a separate user kafka to run this command. I get the error message

mkdir: cannot create directory '/usr/bin/../logs': Permission denied
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /usr/bin/../logs/schema-registry.log (No such file or directory)
[...]

I would rather not give the kafka write access to the entire /usr/bin directory. Where exactly is Kafka trying to create the logs directory?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Elias Strehle
  • 1,722
  • 1
  • 21
  • 34

1 Answers1

3

The kafka-avro-console-consumer respects the LOG_DIR environment variable so if you set it, the log file will be written to this directory instead.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Anders Eriksson
  • 533
  • 5
  • 14
  • Anders can you provide anymore detail? I set the `LOG_DIR` variable to point to `/var/log` in my .bashrc and even though it prints `/var/log` when echoed, running the `kafka-avro-console-consumer` command still reports the error and points the file permission error to the `/usr/bin` base path. – DVS Jan 15 '19 at 13:54
  • I think this is a pure unix/bash issue. You can try to set LOG_DIR directly on the command line just before the kafka-avro-console-consumer command. Set it to something you know for sure you can write to. For example `LOG_DIR=~ /usr/bin/kafka-avro-console-consumer ...` – Anders Eriksson Jan 17 '19 at 12:51