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

[BUG]: logrotate config is flawed #72

Closed
nis65 opened this issue Sep 24, 2024 · 1 comment · Fixed by #73
Closed

[BUG]: logrotate config is flawed #72

nis65 opened this issue Sep 24, 2024 · 1 comment · Fixed by #73
Labels
bug Something isn't working

Comments

@nis65
Copy link
Collaborator

nis65 commented Sep 24, 2024

Description of the bug

Looking at my /var/log/mlc/ directory, I see horrible things 😱

root@kappa2:/var/log/mlc# ls -ltra | tail -5
-rw-r--r--  1 root root         0 Sep 24 08:32 ansible.log.2.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz
-rw-r--r--  1 root root         0 Sep 24 08:32 ansible.log.2.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz
-rw-r--r--  1 root root         0 Sep 24 08:32 ansible.log.2.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz
drwxr-x---  2 root root    229376 Sep 24 08:32 .
-rw-r--r--  1 root root   1000036 Sep 24 17:05 ansible.log

These are only the last 5 lines, look at the attachment to see the full mess: ls-ltra-var-log-mlc.txt

I think the root cause is this line, i.e. /var/log/mlc/* matches ALL files including the already rotated ones. From the manpage:

Please use wildcards with caution.  If you specify  *,  logro‐
tate will rotate all files, including previously rotated ones.
A way around this is to use the olddir directive or a more ex‐
act wildcard (such as *.log).

The behaviour can be verified by executing logrotate -d /etc/logrotate.d/mlc-ansible-pull as root.

Q: Do we ever expect a different logfile than ansible.log in /var/log/mlc (or /var/log/potos in the generic case) and if yes, is it fair to configure logrotating only for files ending in *log?.

If yes, the old line

{{ potos_basics_ansible_logdir }}/* {

could simply be replaced by

{{ potos_basics_ansible_logdir }}/*log {

And all would be good. Agree @fadnincx ?

Steps To Reproduce

See above.

Additional Information

See above.

@nis65 nis65 added the bug Something isn't working label Sep 24, 2024
@fadnincx
Copy link
Collaborator

You are totally right. If I remember correctly, there can be other files besides ansible.log such as setup.log. So I prefer having the generic fix with *.log. -> See #73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants