Rsyslog pass log to script

rsyslogsyslog

I have been trying to pass captured log to a perl script, however I can not seem to find the right way. Do you have any suggestions for correct way of sending captured log to a script for further processing?

I can activate this script with this but, I can't pass the captured message:

$ModLoad omprog
$template MyTemplateName,"some\n"

if $programname == 'arpwatch' and $msg contains 'new station' then {
    action(type="omprog" binary="/tmp/somescript.pl" template="MyTemplateName")
}

Best Answer

Well... turns out it's easier than it looked like. For some reason I could not successfully apply "action", so I went for the old way of doing this. Captured log messaged is sent as argument in default template format if not specified otherwise.

if $programname == 'arpwatch' and $msg contains 'new station' then {
    ^/opt/bin/script.pl
}
Related Topic