On Mon, 22 Aug 2016, Bjørnar Ness wrote:

I am using omfile/dynaFile to split log files like this:

template(
       name="apacheFilename"
       type="string"
       
string="/var/log/web/%$.logtype%/%$YEAR%/%$MONTH%/%$DAY%/%$HOUR%/%hostname%/%msg:R,ERE,1,ZERO:^([a-zA-Z0-9_.-]+)[
:]--end%"
)

Problem is some of the error-logs grows HUGE, and I want string to be
/dev/null when size of the file is above some set limit, say 10MB. Can
this be accomplished either with template, or some other way?

There is not a way for rsyslog to test the size of the log file in the config. output channels will let you specifiy a max size and call a script when that size is hit. But most people just go with an external tool to deal with the problem. This sort of thing is exactly what logrotate was designed to handle.

On my central logging servers where many logs get very large very quickly, I just rotate the log files every minute.

David Lang
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to