Logrotate using rsyslog's omprog hangs over time

565 views Asked by At

Tried almost everything, but still cant find any solution for the issue so wanted to ask for little help in such case:

I have got logrotate (v. 3.7.8) configured based on size of log files:

/home/test/logs/*.log {
  missingok
  notifempty
  nodateext
  size 10k
  rotate 100
  copytruncate
}

Rotation of logs is based only on size, invoked whenever message will arrived to rsyslog deamon (v. 5.8.10). Configuration of rsyslog:

$ModLoad omprog
$ActionOMProgBinary /usr/local/bin/log_rotate.sh
$MaxMessageSize 64k

$ModLoad imuxsock
$ModLoad imklog
$ModLoad imtcp

$InputTCPServerRun 514

$template FORMATTER, "%HOSTNAME% | %msg:R,ERE,4,FIELD:(.*)\s(.*)(:::)(.*)--end%\n"
$ActionFileDefaultTemplate FORMATTER

$Escape8BitCharactersOnReceive off
$EscapeControlCharactersOnReceive off

$SystemLogRateLimitInterval 0
$SystemLogRateLimitBurst 0

$FileOwner test
$FileGroup test
$DirOwner test
$DirGroup test

# Log each module execution to separate log files and don't use the prepending module_execution_ in the log name.
$template CUSTOM_LOGS,"/home/test/logs/%programname:R,ERE,1,FIELD:^module_execution_(.*)--end%.log"
if $programname startswith 'module_execution_' then :omprog:
if $programname startswith 'module_execution_' then ?CUSTOM_LOGS
& ~

Script invoked by the omprog just runs logrotate and for test purpose sends new line to logrot file:

 #!/bin/bash
 echo "1" >> /home/test/logrot
 /usr/sbin/logrotate /etc/logrotate.conf -v

How to reproduce:

  • execute:

    for i in {1..50000}; do logger -t "module_execution_test" "test message"; done;

  • check rotate files - there will be a lot of files test.log.1,2,3 etc. with size near to the 10kB and one test.log with size much bigger then predicted
  • check:

    wc -l /home/test/logrot It will be growing for some time but then stops even if the messages still arrives (hangs exactly in the time when rotation stops to happen) - it means that rsyslog doesnt call external script anymore

So IMO it looks like a bug in rsyslog or omprog plugin. Any idea what is going on?

br

0

There are 0 answers