Right. Thanks :)<br><br><div class="gmail_quote">On Fri, Aug 10, 2012 at 4:31 PM, Pal Tamas <span dir="ltr"><<a href="mailto:folti@balabit.hu" target="_blank">folti@balabit.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
IMO you should put the 2 lines before the while() block. You only have<br>
to set it once.<br>
<div><div class="h5"><br>
On Fri, Aug 10, 2012 at 09:02:26AM +0800, Jian Zhu wrote:<br>
> Thanks you Evan for you quick response. I changed my script as below and now<br>
> it's working fine.<br>
><br>
> #!/usr/bin/perl<br>
><br>
> $i=0;<br>
> while(true){<br>
> $i++;<br>
> #added below 2 lines to force a flush right away and after every print<br>
> #according to perl document: "STDOUT will typically be line buffered if<br>
> output is to the terminal and block buffered otherwise."<br>
> #since the output is not to terminal so here it's block buffered, i<br>
> guess this is the root cause.<br>
> select(STDOUT);<br>
> $| = 1;<br>
><br>
> print STDOUT "hello $i\n";<br>
><br>
> sleep 1;<br>
><br>
> }<br>
><br>
><br>
><br>
><br>
><br>
> On Fri, Aug 10, 2012 at 8:52 AM, Evan Rempel <<a href="mailto:erempel@uvic.ca">erempel@uvic.ca</a>> wrote:<br>
><br>
> You are probably suffering from perl's buffering. I forget the exact syntax right now but a quick google of disabling Perl auto flush should give you what you need.<br>
><br>
> Jian Zhu <<a href="mailto:zhujian0805@gmail.com">zhujian0805@gmail.com</a>> wrote:<br>
><br>
><br>
> Hello,<br>
><br>
> Could anyone please help me on this below issue?<br>
><br>
> my syslog-ng.conf file look like below:<br>
><br>
> The test.sh script work fine, I can see it's output in the test.sh.log<br>
> file.<br>
> But the <a href="http://test.pl" target="_blank">test.pl</a> doesn't work. the test.sh and <a href="http://test.pl" target="_blank">test.pl</a> have the same<br>
> function of printing something to STDOUT.<br>
> ------------------------------<br>
> -------------------------------------------------------------------------------------------------------------------<br>
> @version: 3.0<br>
> #Default configuration file for syslog-ng.<br>
> #<br>
> # For a description of syslog-ng configuration file directives, please read<br>
> # the syslog-ng Administrator s guide at:<br>
> #<br>
> # <a href="http://www.balabit.com/dl/html/syslog-ng-admin-guide_en.html/" target="_blank">http://www.balabit.com/dl/html/syslog-ng-admin-guide_en.html/</a><br>
> bk01-toc.html<br>
> #<br>
> options {<br>
> # Number of syslog lines stored in memory before being written to files<br>
> flush_lines (0);<br>
> log_fifo_size (2048);<br>
> create_dirs (yes);<br>
> perm (0640);<br>
> dir_perm (0750);<br>
> };<br>
><br>
><br>
><br>
> source ppp { program("/root/perl/<a href="http://test.pl" target="_blank">test.pl</a>"); };<br>
> destination ppp {<br>
> file ("/var/log/syslog-ng/$HOST/perl.pl.log" create_dirs(yes));<br>
> };<br>
> log {<br>
> source(ppp);<br>
> destination(ppp);<br>
> };<br>
><br>
> source sss { program("/root/shell/test.sh"); };<br>
> destination sss {<br>
> file ("/var/log/syslog-ng/$HOST/test.sh.log" create_dirs(yes));<br>
> };<br>
> log {<br>
> source(sss);<br>
> destination(sss);<br>
> };<br>
> -------------------------------------------------------------------------------------------------------------------------------------------------<br>
><br>
><br>
> --<br>
><br>
> Thanks & Best Regards<br>
><br>
> James Zhu<br>
><br>
> Mobile: <a href="tel:%2B86%20186%208482%202818" value="+8618684822818">+86 186 8482 2818</a><br>
><br>
> Email: <a href="mailto:zhujian0805@gmail.com">zhujian0805@gmail.com</a><br>
><br>
><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=" target="_blank">http://www.balabit.com/support/documentation/?product=</a><br>
> syslog-ng<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>
><br>
><br>
><br>
><br>
> --<br>
><br>
> Thanks & Best Regards<br>
><br>
> James Zhu<br>
><br>
> Mobile: <a href="tel:%2B86%20186%208482%202818" value="+8618684822818">+86 186 8482 2818</a><br>
><br>
> Email: <a href="mailto:zhujian0805@gmail.com">zhujian0805@gmail.com</a><br>
><br>
><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><br>
><br>
<br>
<br>
--<br>
</div></div>Pal Tamas/Folti<br>
<a href="mailto:folti@balabit.hu">folti@balabit.hu</a><br>
<div class="HOEnZb"><div class="h5"><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><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><p><b><a name="SafeHtmlFilter_SafeHtmlFilter__MailAutoSig"><span>Thanks & Best Regards</span></a></b></p>
<p style="color:rgb(0,0,153)"><b><i><span><span style="font-size:10pt">James Zhu</span></span><span><span style="font-size:10pt"></span></span></i></b></p>
<span><span></span></span><span><span></span></span>
<p><span><b><span>Mobile</span></b></span><span><b><span style="font-size:10.0pt;color:#444444">:</span></b></span><span><span> <i style="color:rgb(51,0,51)">+86 18</i></span></span><i style="color:rgb(51,0,51)"><span><span style="font-size:10pt">6</span></span><span><span> </span></span><span><span style="font-size:10pt">8482 2818</span></span></i><span><span style="font-size:12.0pt;font-family:"Times New Roman","serif";color:black"></span></span></p>
<p><span><b><span style="font-size:10pt;color:black">Email: </span></b><span style="font-size:10pt;color:rgb(102,51,51)"><a href="mailto:zhujian0805@gmail.com" target="_blank">zhujian0805@gmail.com</a></span></span></p><br>