Browse Source

Salt: add logrotate config for nginx logs

merge-requests/70/head
Deimos 6 years ago
parent
commit
f880ab9edd
  1. 8
      salt/salt/nginx/init.sls
  2. 15
      salt/salt/nginx/logrotate

8
salt/salt/nginx/init.sls

@ -23,3 +23,11 @@ nginx:
- user: root
- group: root
- mode: 644
# Add logrotate config to rotate daily and delete after 30 days
/etc/logrotate.d/nginx:
file.managed:
- source: salt://nginx/logrotate
- user: root
- group: root
- mode: 644

15
salt/salt/nginx/logrotate

@ -0,0 +1,15 @@
/var/log/nginx/*.log {
daily
missingok
rotate 30
compress
delaycompress
notifempty
create 640 nginx adm
sharedscripts
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 `cat /var/run/nginx.pid`
fi
endscript
}
Loading…
Cancel
Save