Skip to content

Instantly share code, notes, and snippets.

@TGion
Created June 12, 2023 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TGion/6341629316cc0d42b6cffa1929bfc5f1 to your computer and use it in GitHub Desktop.
Save TGion/6341629316cc0d42b6cffa1929bfc5f1 to your computer and use it in GitHub Desktop.
Newsyslog logrotation for nginx services
# Nextcloud
# [logfile name] [owner-group] [mode] [count] [size] [when] [flags] [path to pid file] [signal]
/var/log/nextcloud/nextcloud.log www:www 640 9 * $D00 BCEJN
# Modsecurity
# Workaround for logrotation on modsecurity to restart nginx - otherwise new logs are not written
# https://github.com/SpiderLabs/ModSecurity-nginx/issues/121
#
# [logfile name] [owner-group] [mode] [count] [size] [when] [flags] [path to pid file] [signal]
/var/log/modsecurity/modsec_audit.json www:www 640 9 * $D00 BCEJR /usr/local/sbin/nginx.restart
# NGINX
# [logfile name] [owner-group] [mode] [count] [size] [when] [flags] [path to pid file] [signal]
/var/log/nginx/access.log www:www 640 9 * $D00 BCEJ /var/run/nginx.pid SIGHUP
/var/log/nginx/error.log www:www 640 9 * $D00 BCEJ /var/run/nginx.pid SIGHUP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment