Re: Discarding empty lines in rsyslog

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 29/02/16 15:59, Anand Buddhdev wrote:

> This works. However, the program sometimes produces blank lines its
> output, and they get logged by rsyslog as well. I want to make rsyslog
> ignore empty lines. I am trying the following, but it doesn't work:
> 
> if $programname == 'progname' and $msg != '\n' then /var/log/prog.log
> 
> Does anyone know how to get this to work in rsyslog? This is rsyslog 5
> on CentOS 6.

Well, no-one replied to it, but I eventually figured it out myself.
Rsyslog converts an empty line (containing just a newline) into a
message of one space, so the correct incantation is:

if $programname == 'progname' and $msg != ' ' then /var/log/prog.log

Anand
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux