openresty-packaging icon indicating copy to clipboard operation
openresty-packaging copied to clipboard

OpenResty Ubuntu package has no logrotate configuration

Open brendon opened this issue 4 years ago • 2 comments

I was surprised to see that there is no logrotate configuration for the Ubuntu package. I only realised once the server ran out of space :D Here's what I ended up using:

var/log/openresty/*.log {
  daily
  missingok
  rotate 52
  compress
  delaycompress
  notifempty
  create 640 root root
  sharedscripts
  postrotate
    if [ -f /usr/local/openresty/nginx/logs/nginx.pid ]; then
      kill -USR1 `cat /usr/local/openresty/nginx/logs/nginx.pid`
    fi
  endscript
}

This is basically the same as the nginx Ubuntu 20.04 package's configuration with a tweak to the pid file location and the user and group of the log file ownership.

brendon avatar Nov 23 '21 00:11 brendon

Hi @brendon, Thanks for the suggestion, logrotate relies on the logrotated service and the log path is customizable. Of course, you can make your own debian package if you like, by modified the packaging script of this repo.

xiaocang avatar Nov 23 '21 14:11 xiaocang

Thanks @xiaocang :) That's all good. I was just letting you know in case it was an oversight as I think people would probably expect the default logs to be rotated by default like the nginx package does. Perhaps on the Debian or Ubuntu package page you could add a little note about needing to manually do log rotation so that it doesn't catch people out?

brendon avatar Nov 23 '21 19:11 brendon