<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">If i do strace on python program i see
only read:<br>
<br>
<small>read(0, "Oct 21 18:34:12 suse11/localhost"..., 8192) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
read(0, "Oct 21 18:34:12 suse11/localhost"..., 4096) = 611<br>
</small><br>
<br>
<br>
<br>
Il 21/10/2015 19:54, Giovanni Mancuso ha scritto:<br>
</div>
<blockquote cite="mid:5627D171.4020700@par-tec.it" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
Hi, <br>
i wrote a program destination (in python) that parse a message and
insert data in redis.<br>
<br>
My code is:<br>
<small>import re<br>
import fileinput<br>
import redis<br>
<br>
r = redis.Redis(host="127.0.0.1", port=6379, db=0)<br>
<br>
for line in fileinput.input():<br>
tid = re.search('X-TransactionId: (.+?) ', line)<br>
#print tid.group(1)<br>
regexp_result = re.findall(" Recipient:
([A-z0-9._%+-]+@[A-z0-9.-]+)", line)<br>
for email in regexp_result:<br>
r.sadd(tid.group(1)+"_recs", email)</small><br>
<br>
I configure my destination in this way:<br>
<small>destination python_to_file {<br>
program("/usr/bin/python
/etc/syslog-ng/python/Ric_acc_dest.py" flush-lines(1));<br>
};</small><br>
<br>
It works only if i send many message. If i send only one message
it doesn't insert nothing in redis.<br>
<br>
Any ideas?<br>
<br>
<br>
<br>
<div class="moz-signature">-- <br>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">______________________________________________________________________________
Member info: <a class="moz-txt-link-freetext" href="https://lists.balabit.hu/mailman/listinfo/syslog-ng">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a>
Documentation: <a class="moz-txt-link-freetext" href="http://www.balabit.com/support/documentation/?product=syslog-ng">http://www.balabit.com/support/documentation/?product=syslog-ng</a>
FAQ: <a class="moz-txt-link-freetext" href="http://www.balabit.com/wiki/syslog-ng-faq">http://www.balabit.com/wiki/syslog-ng-faq</a>
</pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="font-family:Verdana; font-size:14px;
color:#ff661b;"><strong>Giovanni Mancuso</strong></td>
</tr>
<tr>
<td style="font-family:Verdana; font-size:12px; color:#000;
padding-bottom:8px;">System Architect</td>
</tr>
<tr>
<td>
<table width="355" cellpadding="0" cellspacing="0"
height="5">
<tbody>
<tr>
<td style="background-color:#ff661b; height:5px;
font-size:1px; min-width:355px; width:355px;
max-height:5px; display:block; line-height:1px;"> </td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-family:Verdana; font-size:12px; color:#000;
padding-top:8px;"><strong>T</strong> 06.9826.9600 <strong>M</strong>
+39.340.65.80.739 <strong>F</strong> 06.9826.9680</td>
</tr>
<tr>
<td style="font-family:Verdana; font-size:12px; color:#000;">P.zza
S.Benedetto da Norcia, 33 - 00071 Pomezia (RM)</td>
</tr>
<tr>
<td style="font-family:Verdana; font-size:9px;"><a
href="http://www.par-tec.it" target="_blank" alt=""> <img
src="cid:part1.06040106.06000608@par-tec.it"
alt="Par-Tec S.p.A." title="Par-Tec S.p.A."
style="padding:0; margin:0" border="0"></a> <a
href="http://www.par-tec.it" target="_blank" alt=""> <img
src="cid:part3.00050907.02020309@par-tec.it" alt="Web
Site" title="Web Site" style="padding:0; margin:0"
border="0"></a> <a href="mailto:info@par-tec.it"> <img
src="cid:part5.04010604.05040509@par-tec.it"
alt="info@par-tec.it" title="info@par-tec.it"
style="padding:0; margin:0" border="0"></a> <a
href="https://www.facebook.com/ParTecSpA"
target="_blank"> <img
src="cid:part7.05050607.06030304@par-tec.it"
alt="Pagina Facebook" title="Pagina Facebook"
style="padding:0; margin:0" border="0"></a> <a
href="https://twitter.com/partecspa" target="_blank"> <img
src="cid:part9.00050109.07010703@par-tec.it"
alt="Profilo Twitter" title="Profilo Twitter"
style="padding:0; margin:0" border="0"></a> <a
href="https://www.linkedin.com/company/par-tec/"
target="_blank"> <img
src="cid:part11.06090602.02090009@par-tec.it"
alt="Pagina LinkedIn" title="Pagina LinkedIn"
style="padding:0; margin:0" border="0"></a> <a
href="https://www.youtube.com/user/ParTecSpA"
target="_blank"> <img
src="cid:part13.02050509.08070901@par-tec.it"
alt="Canale YouTube" title="Canale YouTube"
style="padding:0; margin:0" border="0"></a> </td>
</tr>
<tr>
<td style="font-family:Verdana; font-size:9px; color:#999">CONFIDENZIALE:
Questo messaggio ed i suoi allegati sono di carattere
confidenziale per i destinatari in indirizzo.<br>
È vietato l'inoltro non autorizzato a destinatari diversi
da quelli indicati nel messaggio originale.<br>
Se ricevuto per errore, l'uso del contenuto è proibito; si
prega di comunicarlo al mittente e cancellarlo
immediatamente.<br>
</td>
</tr>
</tbody>
</table>
<br>
</div>
</body>
</html>