[rsyslog-notify] Forum Thread: Re: Can not get my omprog program to work - (Mode 'reply')
noreply at adiscon.com
noreply at adiscon.com
Wed Mar 12 21:20:16 CET 2014
User: craigesmith
Forumlink: http://kb.monitorware.com/viewtopic.php?p=24357#p24357
Message:
----------
Until I added the fd.flush() to the Python code, I found that the output
was being buffered until the script got an EOF. I added the time.sleep(.75)
to prevent the script from grabbing a ton of CPU.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
import syslog
[code:355m17ld]fd = open('/tmp/rsyslogomoutput.txt', 'a')
fd.write("Opened logfile\n")
while True:
line = sys.stdin.readline()
if line:
fd.write("Received: %s" % (line))
fd.flush()
else:
break
time.sleep(0.75)
fd.close()[/code:355m17ld]
More information about the rsyslog-notify
mailing list