<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.StileMessaggioDiPostaElettronica17
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=IT link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Hello.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Perfect! Problem solved using templates!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>RS<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>Da:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> syslog-ng [mailto:syslog-ng-bounces@lists.balabit.hu] <b>Per conto di </b>Scheidler, Balázs<br><b>Inviato:</b> martedì 24 aprile 2018 16:52<br><b>A:</b> Syslog-ng users' and developers' mailing list <syslog-ng@lists.balabit.hu><br><b>Oggetto:</b> Re: [syslog-ng] R: Destination program input<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Because we are using the standard syslog format when sending it to a program() destination and 190 tells the facility and severity of the message.<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>You can customize the output using a template() option, e.g.:<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>program("/bin/foobar" template("$ISODATE $HOST $MSGHDR$MSG\n"));<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>But you can include any macro or name-value pair in the template, or even transform the output using template functions.<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>The template language is a pretty powerful part of syslog-ng that allows a lot of customization on how a log message is sent to a peer.<o:p></o:p></p></div><p class=MsoNormal>Bazsi<o:p></o:p></p></div><div><p class=MsoNormal><br clear=all><o:p></o:p></p><div><div><div><p class=MsoNormal>-- <br>Bazsi<o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Tue, Apr 24, 2018 at 4:47 PM, Scappatura Rocco <<a href="mailto:Rocco.Scappatura@infracom.it" target="_blank">Rocco.Scappatura@infracom.it</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=MsoNormal>Hello.<br><br>I have found the problem that cause my destination program not work.<br><br>Indeed I see that the log line received by the destination program are preceeded by the string '<190>'.<br><br>I can't explain why this strings appear, but after updating the program so that the log line are trimmed of the leading characters, the program has worked as I expected.<br><br>Could someone explain why the string '<190>' appear?<br><br>Regards,<br><br>Rocco<br><br><br><br>> -----Messaggio originale-----<br>> Da: syslog-ng [mailto:<a href="mailto:syslog-ng-bounces@lists.balabit.hu">syslog-ng-bounces@lists.balabit.hu</a>] Per conto di<br>> Scappatura Rocco<br>> Inviato: lunedì 23 aprile 2018 11:08<br>> A: '<a href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a>' <<a href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a>><br>> Oggetto: [syslog-ng] R: Destination program input<o:p></o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>> <br>> Hello.<br>> <br>> Thanks for the answer Sandor Geller.<br>> Could you please show me a template program() destination that works<br>> following the logic you explained in your answer?<br>> <br>> Regards,<br>> <br>> Rocco<br>> <br>> > -----Messaggio originale-----<br>> > Da: Scappatura Rocco<br>> > Inviato: venerdì 20 aprile 2018 18:40<br>> > A: '<a href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a>' <<a href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a>><br>> > Oggetto: Destination program input<br>> ><br>> > Hello.<br>> ><br>> > I have written a C program that read the successful POP3 access log<br>> > lines to my POP3 server. After get one line, it get the time and the<br>> > POP3 account that logged in. These data are then stored in the account<br>> MySQL database.<br>> ><br>> > The program (named 'pop3_access') works fine:<br>> ><br>> > echo "Apr 10 12:00:17 mail1 pop3d: LOGIN, user= <a href="mailto:xxx@domain.tld">xxx@domain.tld</a>,<br>> > ip=[::ffff:xxx.yyy.zzz.vvv], port=[56196]"|./pop3_access<br>> ><br>> > Infact quering DB, I get:<br>> ><br>> > username pop3_last_access<br>> > <a href="mailto:xxx@domain.tld">xxx@domain.tld</a> 2018-04-10 12:00:17<br>> ><br>> > I have configured syslog:<br>> ><br>> > filter f_pop3_access { facility(local7) and match ('LOGIN,'); };<br>> > destination d_pop3_last_access { program("/usr/local/bin/pop3_access<br>> > >/dev/null" ); }; log { source(src); filter(f_pop3_access);<br>> > destination(d_pop3_last_access); };<br>> ><br>> > But no rows are inserted in the database..<br>> ><br>> > From log of destination program 'pop3_access' I see the it remains in<br>> > a while loop waiting for an 'EOF' that never arrives:<br>> ><br>> > while (fgets(line, MAXSTR, stdin)) {<br>> > if (sscanf(line, "%s %d %s %s %s %s %s %s %s", mese, &giorno,<br>> > ora, s, proto, comando, u, ip, porta) != 9){<br>> > syslog (LOG_NOTICE, "Errore scanf");<br>> > exit(-1);<br>> > }<br>> > }<br>> ><br>> > How I have to do so that my program succeed in taking the syslog row<br>> > correctly, and then returns after process the data as expected?<br>> ><br>> > Regards,<br>> ><br>> > Rocco Scappatura<br>> __________________________________________________________<br>> ____________________<br>> Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>> Documentation:<br>> <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>> FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br><br>______________________________________________________________________________<br>Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><o:p></o:p></p></div></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>