I've noticed that the mail logs which are being created in /var/log
are being created and owned by root (user and group).
I've written a Nagios check which monitors the log and in order to allow the Nagios user to access it, I gave the other
group read permissions, that is:
chmod o+r /var/log/maillog
Now when I think about it, this is only one log file, when the log file will get filled the log rotate mechanism will rename this file and open a new one, but the new maillog
file will not have the read write
which I allowed.
So my question is, how can I make sure that the log rotate mechanism will create all the new mailllog files with the right permissions for the Nagios user?
Thanks in advance
logrotate
has thecreate
option:More info with
man logrotate
.Use it like so:
either in
/etc/logrotate.conf
or a separate file in/etc/logrotate.d
and check if no other file already overrides this. How this is configured depends on your OS (e.g. on Ubuntu, this is handled in thersyslog
configuration).