Logrotate config for per-user nginx log files

HI,

I noticed today (when the log files filled the /var/log mount) that the per-user nginx log files in /var/log/ondemand-nginx/$USER/ are not being rotated. I tried a few different approaches in /etc/logrotate.d/ondemand-nginx but I never figured out how to use a signal to get the user nginx and Passenger processes to let go of the old log files. So I settled on this:

/var/log/ondemand-nginx/*log /var/log/ondemand-nginx/*/*log {
    create 0644 ondemand-nginx ondemand-nginx
    daily
    rotate 10
    copytruncate
    missingok
    notifempty
    compress
}

My feature request is for a better logrotate config than the one I came up with.

Best,

griznog

This is what we use at OSC:

/var/log/ondemand-nginx/*/access.log /var/log/ondemand-nginx/*/error.log {
  compress
  copytruncate
  missingok
  notifempty
  rotate 52
  weekly
}

Any chance this could go into the upstream distribution to replace the current version that ships in the rpms?

Off-topic: I wanted to ‘like’ your version, but discourse uses a heart which seemed like more commitment than I’m ready for right now. I mean, I just met your ondemand-nginx logrotate config and it’d feel ok to give a thumbs up but we need to get to know each other better before a heart is appropriate. I’m old-fashioned that way.

1 Like

I’ve opened pull request to include a basic logrotate config for OnDemand RPMs.