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

Unknown groups/users don't appear to be rotated #25

Open
josh1703658784 opened this issue Jul 18, 2018 · 6 comments
Open

Unknown groups/users don't appear to be rotated #25

josh1703658784 opened this issue Jul 18, 2018 · 6 comments

Comments

@josh1703658784
Copy link

josh1703658784 commented Jul 18, 2018

I have many log files present in /var/log/company_name to be rotated on an hourly basis into /var/log/company_name/rotated, keeping the past 24-hours. All logs seem to be rotating except a select few, which grow to gigabytes in size.

Upon inspecting the logrotate logs with docker logs logrotate, it appears that all the logfiles that aren't rotating have the following message printed when processing:

Found new file /var/log/company_name/mysql_error.log, Processing...
File has unknown user or group: , user: UNKNOWN, group: video

However, logfiles that are properly rotated have the following message printed:

Found new file /var/log/company_name/wkhtmltopdf.gunicorn.log, Processing...
Inserting new /var/log/company_name/wkhtmltopdf.gunicorn.log to /usr/bin/logrotate.d/logrotate.conf

Other notes:
User: root
Logrotate version: 1.2
Logrotate hash: sha256:e0d5e50a8716d7859079df4849f9034c56d0cb38ed46ad118b87e41f8a9437d6
Capabilities: dac_override, setgid, setuid
Network: none
Environment:

LOGROTATE_INTERVAL=hourly
LOGS_DIRECTORIES=/var/log/company_name
LOGROTATE_OLDDIR=/var/log/company_name/rotated
LOGROTATE_LOGFILE=/var/log/company_name/logrotate.log
LOGROTATE_COPIES=24
LOGROTATE_COMPRESSION=compress
LOGROTATE_STATUSFILE=/company_name/logrotate_status/logrotate.status
LOGROTATE_PARAMETERS=vf

I also tried enabling all capabilities and the network without any luck.

The error message appear accurate when running an ls -lahS on the log directory. But I don't understand why logrotate won't touch those files or how to force it to work with those files.

@blacklabelops
Copy link
Owner

Logrotate need to know under which permission he has to create the rotated files.

Files with unknown user or group are currently ignored.

blacklabelops pushed a commit that referenced this issue Jul 18, 2018
@blacklabelops
Copy link
Owner

Default behavior is now set to not ignore any files with unknown user or group but rotate it with the default user.

This should not be any problem because container's default user is root.

Would be a problem, when the container is not run as root.

@josh1703658784
Copy link
Author

That's awesome!

Off the top of your head, would logrotate accept uid/gid in the generated config file? I might give that a try.

@blacklabelops
Copy link
Owner

No

@josh1703658784
Copy link
Author

I ended up writing a script that generates users dynamically when required. Is this something you would be interested in adding to the project?

@blacklabelops
Copy link
Owner

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants