system-config/playbooks/roles/logrotate/README.rst
Ian Wienand 1e2ea795c2
logrotate: don't use filename to generate config file
I noticed on our hosts some logrotate files named '*.1234.conf' --
these are coming from callers of logrotate role specifying
'/var/log/program/*.log', where the '*' is turning into a literal
filename.  I didn't really consider this case.

Having a file-name starting with '*' may technically be fine, but is a
bad idea for everyone's sanity and it's potential to foot-gun some
sort of operation that suddenly wipes out a lot more than you wanted
to.

Let's just use the hash of the name to be unambiguous and still
idempotent.  Make it more git-ish by using the same 7 digits as a
default short-hash.

Change-Id: I13d376f85a25a7b8c3a0bc0dcbabd916e8a9774a
2023-02-14 07:03:17 +11:00

1.6 KiB

Add log rotation file

Note

This role does not manage the logrotate package or configuration directory, and it is assumed to be installed and available.

This role installs a log rotation file in /etc/logrotate.d/ for a given file.

For information on the directives see logrotate.conf(5). This is not an exhaustive list of directives (contributions are welcome).

** Role Variables **

The full path to log file on disk to rotate. May be a wild-card; e.g. /var/log/progname/*.log.