How to enable log rotation in rsyslog configuration. The method described in the official documentation of rsyslog using output channels is not working for me.
The script given in the official documentation of rsyslog for output channel is available here: https://www.rsyslog.com/doc/master/tutorials/log_rotation_fix_size.html
module(load="imudp" TimeRequery="500")
module(load="omstdout")
module(load="omelasticsearch")
module(load="mmjsonparse")
module(load="mmutf8fix")
ruleset(name="prismaudit_rs") {
action(type="omfile" dirCreateMode="0777" fileCreateMode="0777" file="/logs/prismaudit.log")
}
$outchannel log_rotation,/logs/prismaudit.log, 3000,/etc/log_rotation_script
*.* :omfile:$log_rotation
#input(type="imptcp" port="514")
input(type="imudp" port="514" ruleset="prismaudit_rs")
This is the snippet of code I am using. I have also tried adding the outputchannel part of code inside the ruleset(after action statement).
My log rotation script: mv -f /logs/prismaudit.log /logs/log_rotation.log.1