If i do strace on python program i see
only read:
read(0, "Oct 21 18:34:12 suse11/localhost"..., 8192) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611
Il 21/10/2015 19:54, Giovanni Mancuso ha scritto:
Hi,
i wrote a program destination (in python) that parse a message and
insert data in redis.
My code is:
import re
import fileinput
import redis
r = redis.Redis(host="127.0.0.1", port=6379, db=0)
for line in fileinput.input():
tid = re.search('X-TransactionId: (.+?) ', line)
#print tid.group(1)
regexp_result = re.findall(" Recipient:
([A-z0-9._%+-]+@[A-z0-9.-]+)", line)
for email in regexp_result:
r.sadd(tid.group(1)+"_recs", email)
I configure my destination in this way:
destination python_to_file {
program("/usr/bin/python
/etc/syslog-ng/python/Ric_acc_dest.py" flush-lines(1));
};
It works only if i send many message. If i send only one message
it doesn't insert nothing in redis.
Any ideas?
--
______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
FAQ: http://www.balabit.com/wiki/syslog-ng-faq