sleighzy / ansible-kafka

Ansible role for installing and configuring Apache Kafka on RedHat and Debian platforms.
MIT License
122 stars 80 forks source link

Add more options to be tweaked + small improvements #6

Closed gothicx closed 3 years ago

gothicx commented 3 years ago

These changes were done in order to be able to better customize the Kafka cluster and separate data logs from application logs.

I didn't run the molecule testing.

sleighzy commented 3 years ago

Hi @gothicx , Can you please run ansible-lint */.yaml over this as there are some linting issues that need to be resolved.

sleighzy commented 3 years ago

Hi @gothicx , one option for supporting the symlink and logs for both new and previous installations could be to,

  1. Add Environment="LOG_DIR={{ kafka_log_dir }}" to the kafka.service file so that Kafka/log4j writes to that directory, instead of defaulting to the application install dir of /opt/kafka/logs
  2. Check to see if the directory /opt/kafka/logs already exists, and create the symlink from there to /var/log/kafka if it doesn't.

This way all logs will go to /var/log/kafka as per this PR. Any existing logs, if present from a previous installation, will still remain. If the symlink is created then if the LOG_DIR environment variable was never set for some reason then Kafka/log4j would default to /opt/kafka/logs, and the logs would still end up going to /var/log/kafka. Does that sound reasonable?

gothicx commented 3 years ago

Hi Simon,

I think I've tried the environment variable for LOG_DIR and it didn't work for some reason.

I was involved in another project and didn't had much time to work on this. I'll try next week ;-)

Thanks.

sleighzy commented 3 years ago

Hi Marco.

I have tested out a change based on the comments about using the LOG_DIR environment variable which has worked as expected. Don't know if you progressed any of this recently. Unless objections I'll work to resolve these conflicts (tomorrow if not the next couple of days) and merge in your PR and then apply that change afterwards.

Thanks.

gothicx commented 3 years ago

Hi Simon,

Thank you !

sleighzy commented 3 years ago

No worries, thanks for your contributions, much appreciated.