Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logrotate config file/task + CI updates #16

Merged
merged 14 commits into from
Oct 30, 2021

Conversation

fidanf
Copy link
Contributor

@fidanf fidanf commented Oct 11, 2021

Greetings,

Here is a simple PR for a simple need. Thanks for the review

Copy link
Owner

@sleighzy sleighzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Frank. Thanks for the PR, much appreciated as always.

I’m currently on vacation for a few days so may be a bit delayed in my responses. I noticed that the Molecule test in the build process failed. Seems like maybe a role name issue and unrelated to your changes. Is possibly due to these latest Ansible Galaxy changes and the name of my repo, see https://galaxy.ansible.com/docs/contributing/creating_role.html#role-names. Would you be able to add that role_name: kafka Entry in the meta/main.yaml file like they mention in your next push and see if that resolves it please.

Cheers.

@@ -0,0 +1,11 @@
{{ kafka_root_dir }}/logs/*.log {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it will resolve to /opt/logs/*.log. Should be {{ kafka_log_dir }}/*.log instead.

delaycompress
missingok
copytruncate
create 644 {{ kafka_user }} {{ kafka_group }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look at the docs and the copytruncate option says that the create option will be ignored if copytruncate is used.

https://linuxconfig.org/logrotate-8-manual-page

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made all the requested changes with added CI refactoring. Waiting for your feedbacks :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I'm happy with all the CI changes but not 100% sure about the logrotate stuff. Kafka already has log4j config that will roll the logs on a daily basis, which logrotate is also doing here. It's unclear to me if you would have "conflicts" and have logs being rolled over twice. You'd get some rolled over logs with a numeric suffix and some with a date suffix. An alternative approach could be to instead template in the default Kafka log4j config, but with an updated copy that uses the filesize and max number of files instead, the same config as you have used for logrotate. This would need to use the log4j RollingFileAppender instead of the DailyFileAppender, see here for an example https://stackoverflow.com/questions/51970191/log-rotation-based-on-monthly-and-log-retention-for-30-days-in-rollingfileappend. The downside to this however is that this will only then roll by size, and not by date...but this may not be an issue. Thoughts?

Copy link
Contributor Author

@fidanf fidanf Oct 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bringing up logrotate was meant to be an opportunistic and easy change to make, which does not requires much Kafka/log4j knowledge. Therefore I understand and agree with your concerns.
If we want this role to be as much enterprise-ready as possible, offering users to configure log4j instead is the way to go.
I suggest I revert the first logrotate commit then add a jinja template and default variables to support log4j configuration 👍🏻
The role users will then be free to chose whichever configuration they want to help prevent disk saturation the "right" way.
Thoughts ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I agree, sounds good. Thanks for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready for review

@fidanf fidanf changed the title Add logrotate config file/task Add logrotate config file/task + CI updates Oct 19, 2021
@fidanf fidanf requested a review from sleighzy October 19, 2021 09:00
Copy link
Owner

@sleighzy sleighzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Frank, LGTM.

@sleighzy sleighzy merged commit 92c7187 into sleighzy:master Oct 30, 2021
@fidanf fidanf deleted the feat-logroate branch October 30, 2021 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants