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

Log Rotation #3

Closed
patricegautier opened this issue Aug 28, 2019 · 7 comments
Closed

Log Rotation #3

patricegautier opened this issue Aug 28, 2019 · 7 comments
Labels
bug Something isn't working

Comments

@patricegautier
Copy link

The log file at /srv-internal/data/unms/config/unms/logs/unms.log filled its partition today at 12G and caused the apps to stop functioning.

This is the same issue I believe was described in oznu#48

I see this in my running container:

root@ckv26000:/srv-internal/data/unms# docker exec 305b79531701 cat /etc/logrotate.d/unms
/config/unms/logs/*.log {
size 10M
copytruncate
missingok
rotate 7
compress
delaycompress
}

But it doesn't seem to have any effect.

@Nico640 Nico640 added the bug Something isn't working label Aug 28, 2019
@Nico640
Copy link
Owner

Nico640 commented Aug 28, 2019

I was able to reproduce the issue, however, this only seems to happen on armhf.
It could be that travis's hosts have an umask of 0002, which will cause a file permission of 664.
I will add an manual chmod 644 in the dockerfile.

As already described in the old issue, executing "chmod 644 /etc/logrotate.d/unms" inside the container should fix this.

@patricegautier
Copy link
Author

Applied.

Thanks much for the response, and for picking up this project!

@Nico640
Copy link
Owner

Nico640 commented Aug 28, 2019

No problem :)

Should be fixed in the latest build

@Nico640 Nico640 closed this as completed Aug 28, 2019
@Trunkzeh
Copy link

Trunkzeh commented Oct 31, 2019

@Nico640 Was this fix implemented? My unms.log had reached over 11GB the other day. I've deleted it; restarted unms and it re-created a fresh unms.log file; this morning its over 60MB which isnt a big deal however it doesnt appear logrotate is functioning correctly - the logrotate file stipulates the log file to be no bigger than 10MB. Same issue with ucrm.log as well.

To confirm; the unms logrotate file reports its permission as 0644.

@Nico640
Copy link
Owner

Nico640 commented Oct 31, 2019

@Trunkzeh Yes it was. The fix just sets the file permission of /etc/logrotate.d/unms and ucrm to 644.
As far as I can see, my logrotate on x86 is working fine.

The cron job for logrotate should run daily, so the files can get bigger than 10MB until logrotate executes.
Try executing "/usr/sbin/logrotate -v /etc/logrotate.conf" on the container and check the output / the log files and see if they get rotated.

@Trunkzeh
Copy link

Trunkzeh commented Nov 4, 2019

@Nico640 Found the problem:

rotating pattern: /config/unms/logs/*.log  10485760 bytes (7 rotations)
empty log files are rotated, old logs are removed
considering log /config/unms/logs/ucrm.log
error: skipping "/config/unms/logs/ucrm.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
considering log /config/unms/logs/unms.log
error: skipping "/config/unms/logs/unms.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

Fixed it by doing the following:

  1. Setting chmod 755 logs/ && chown root:root logs/
  2. Added su root root to /etc/logrotate.conf
  3. Running /usr/sbin/logrotate -v /etc/logrotate.conf rotated the logs correctly.

@Nico640
Copy link
Owner

Nico640 commented Nov 7, 2019

@Trunkzeh I'm glad you got it fixed! I wonder what happened that it didn't work anymore.

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

No branches or pull requests

3 participants