11 Jul 2020, 00:00

Logrotate

Doc ubuntu

Config de la rotation stockée dans /etc/logrotate.d/mon-journal-a-rotater

De cette forme :

/path/to/my/logfile {
	monthly        # can be daily, weekly
	rotate 12      # keep 12 history files
	compress       # gzip the old logs
	delaycompress  # gzip old logs except the more recent one
	missingok      # does not stop if a file is missing
	notifempty     # does not rotate if file is empty
	create 644 root root # permissions, user and group for the newly created file
}

Force rotation :
logrotate -fv /etc/logrotate.d/mon-journal-a-rotater (force, and verbose)
On peut spécifier directement le fichier de configuration général, /etc/logrotate.conf, qui inclue tout ce qui se trouve dans /etc/logrotate.d/ si on veut rotater l’ensemble des logs.