I have a rsyslog config that suffixes the date to the filename and holds the log files in a non stabdard log directory based on its srver name (long story).
Example -
config includes:
...
$template mailLog,"/var/log/external/%fromhost%/maillog-%$YEAR%%$MONTH%%$DAY%.log"
...
# Log all the mail messages in one place.
mail.* -?mailLog
...
so that I get over time
..
/var/log/external/server/maillog-20170424.log
/var/log/external/server/maillog-20170425.log
/var/log/external/server/maillog-20170426.log
etc.
Over time of course these build up, so i have a cronjob to trim any such logs okder than 30 days. To also save on space I copmpress all the files except todays via a cronjobbed script.
so in fact I get
...
/var/log/external/server/maillog-20170424.log.gz
/var/log/external/server/maillog-20170425.log.gz
/var/log/external/server/maillog-20170426.log
My questions are therefore...
- is there a way for rsyslog to compress these logs once a new log is created at midnight
- is theer a way for rsyslog to remove any logs older than 30 days?
I am of course aware that logrotate does this also, but for the purposes of my inquiry I am only interested in using rsyslog if at all possible.
I expect the removing of older, zipped logs via rsyslog isn't available. But the possibility of zipping files would be of great interest.
cheers
Ian
rsyslog and zipping up "rotated" files
Re: rsyslog and zipping up "rotated" files
You may not like it but the answer is logrotate. Sorry.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: rsyslog and zipping up "rotated" files
LOL. That's not a problem TrevorTrevorH wrote:You may not like it but the answer is logrotate. Sorry.
If it doesn't do it, it doesn't do it.
At least Ive exhausted the possibilities.
cheers
didds