tech:notes_logrotate
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| tech:notes_logrotate [2025/06/01 11:02] – Jean-Baptiste | tech:notes_logrotate [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes logrotate | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | |||
| + | Voir aussi : | ||
| + | * [tmpfiles.d (SystemD)](https:// | ||
| + | |||
| + | `/ | ||
| + | ~~~bash | ||
| + | #!/bin/sh | ||
| + | |||
| + | / | ||
| + | EXITVALUE=$? | ||
| + | if [ $EXITVALUE != 0 ]; then | ||
| + | / | ||
| + | fi | ||
| + | exit 0 | ||
| + | ~~~ | ||
| + | |||
| + | ## Exemple de conf | ||
| + | |||
| + | ~~~ | ||
| + | / | ||
| + | { | ||
| + | copytruncate | ||
| + | weekly | ||
| + | rotate 52 | ||
| + | compress | ||
| + | missingok | ||
| + | size 5M | ||
| + | } | ||
| + | |||
| + | / | ||
| + | missingok | ||
| + | notifempty | ||
| + | sharedscripts | ||
| + | } | ||
| + | |||
| + | / | ||
| + | missingok | ||
| + | notifempty | ||
| + | size 30k | ||
| + | yearly | ||
| + | create 0600 root root | ||
| + | } | ||
| + | |||
| + | / | ||
| + | missingok | ||
| + | notifempty | ||
| + | create 644 clam clam | ||
| + | } | ||
| + | |||
| + | / | ||
| + | missingok | ||
| + | notifempty | ||
| + | sharedscripts | ||
| + | delaycompress | ||
| + | postrotate | ||
| + | / | ||
| + | endscript | ||
| + | } | ||
| + | |||
| + | / | ||
| + | compress | ||
| + | copytruncate | ||
| + | maxage 60 | ||
| + | missingok | ||
| + | rotate 5 | ||
| + | size 1M | ||
| + | } | ||
| + | |||
| + | # Rotate OCS Inventory NG agent logs daily, only if not empty | ||
| + | # Save 7 days old logs under compressed mode | ||
| + | / | ||
| + | daily | ||
| + | rotate 7 | ||
| + | compress | ||
| + | notifempty | ||
| + | missingok | ||
| + | } | ||
| + | |||
| + | |||
| + | / | ||
| + | #prerotate loses accounting records, let's no | ||
| + | # | ||
| + | # / | ||
| + | # | ||
| + | compress | ||
| + | delaycompress | ||
| + | notifempty | ||
| + | daily | ||
| + | rotate 31 | ||
| + | create 0600 root root | ||
| + | postrotate | ||
| + | / | ||
| + | endscript | ||
| + | } | ||
| + | |||
| + | / | ||
| + | weekly | ||
| + | missingok | ||
| + | notifempty | ||
| + | sharedscripts | ||
| + | rotate 2 | ||
| + | compress | ||
| + | postrotate | ||
| + | /bin/kill -HUP `cat / | ||
| + | endscript | ||
| + | } | ||
| + | |||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | { | ||
| + | sharedscripts | ||
| + | postrotate | ||
| + | /bin/kill -HUP `cat / | ||
| + | endscript | ||
| + | } | ||
| + | |||
| + | / | ||
| + | missingok | ||
| + | notifempty | ||
| + | size 30k | ||
| + | yearly | ||
| + | create 0600 root root | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | ## Test | ||
| + | |||
| + | ~~~bash | ||
| + | logrotate -df / | ||
| + | ~~~ | ||
| + | |||
| + | |||
