From bf60c28bb588b61e70fc3a6ccf01ebe7af60c67c Mon Sep 17 00:00:00 2001 From: Zsolt Ero Date: Mon, 13 Oct 2025 22:42:45 +0200 Subject: [PATCH] work --- TODO.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..300e8a1 --- /dev/null +++ b/TODO.md @@ -0,0 +1,49 @@ +logrotate + +/var/log/nginx/*.log /var/log/nginx/*/*.log { + daily # rotate at least once per day + dateext # add -YYYYMMDD to rotated files + rotate 7 # keep up to 7 rotations (about 7 days) + maxage 7 # hard limit: delete rotated logs older than 7 days + missingok + compress + delaycompress + notifempty + sharedscripts + create 0640 www-data adm # adjust user:group for your distro (e.g., nginx adm) + postrotate + # Tell nginx to reopen logs without losing lines + [ -s /run/nginx.pid ] && kill -USR1 "$(cat /run/nginx.pid)" || true + # Alternatively: nginx -s reopen + endscript +} + +--- + +sudo systemctl enable --now logrotate.timer +sudo systemctl status logrotate.timer + +/etc/cron.daily/logrotate + +Dry run: +sudo logrotate -d /etc/logrotate.d/nginx +Force a rotation immediately: +sudo logrotate -vf /etc/logrotate.conf + +--- + +/var/log/nginx/*.log { + daily # Rotate every day + rotate 7 # Keep only 7 rotated files + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid` + endscript +} + +--- +