rsyslog omprog (run a shell script on a filtered message)

rsyslog.conf
 
$ModLoad omprog
$actionomprogbinary /opt/omprog.py
:msg, contains, "sometext"  :omprog:;RSYSLOG_TraditionalFileFormat
omprog.py
line = sys.stdin.readline()
if line:
    check(line)