문제

I need the following filter in rsyslog. My syntax is incorrect and it generates an error in the rsyslog logfile:

:programname, isequal, "program1" &
:msg, contains, "an expression" /dev/null
&~

Error is:

the last error occured in /etc/rsyslog.d/50-default.conf, line 18:":programname, isequal, "program1" &"

I'd appreciate if someone could suggest the correct syntax for this property filter, or alternatively the correct RainerScript syntax to do the same thing?

도움이 되었습니까?

해결책

Got the answer with some help from Rainer Gerhards:

if $programname == 'program1' and $msg contains 'an expression' then /dev/null
& stop

Note that for older versions of rsyslog (like V5 that Ubuntu provided with their V13 'Saucy'), you must use single quotes around the attributes. Double quotes work in late mode rsyslog versions like rsyslog V7

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top