[CentOS] rsyslog and zipping up "rotated" files

Wed Apr 26 13:40:54 UTC 2017
Ian Diddams <didds3 at yahoo.co.uk>

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


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 

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 m,y enquiry 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 pssibility of zipping files would be of great interest.