Right. Thanks :)<br><br><div class="gmail_quote">On Fri, Aug 10, 2012 at 4:31 PM, Pal Tamas <span dir="ltr">&lt;<a href="mailto:folti@balabit.hu" target="_blank">folti@balabit.hu</a>&gt;</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>
&gt; Thanks you Evan for you quick response. I changed my script as below and now<br>
&gt; it&#39;s working fine.<br>
&gt;<br>
&gt; #!/usr/bin/perl<br>
&gt;<br>
&gt; $i=0;<br>
&gt; while(true){<br>
&gt;         $i++;<br>
&gt;         #added below 2 lines to force a flush right away and after every print<br>
&gt;         #according to perl document: &quot;STDOUT will typically be line buffered if<br>
&gt; output is to the terminal and block buffered otherwise.&quot;<br>
&gt;         #since the output is not to terminal so here it&#39;s block buffered, i<br>
&gt; guess this is the root cause.<br>
&gt;         select(STDOUT);<br>
&gt;         $| = 1;<br>
&gt;<br>
&gt;         print STDOUT &quot;hello $i\n&quot;;<br>
&gt;<br>
&gt;         sleep 1;<br>
&gt;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Aug 10, 2012 at 8:52 AM, Evan Rempel &lt;<a href="mailto:erempel@uvic.ca">erempel@uvic.ca</a>&gt; wrote:<br>
&gt;<br>
&gt;     You are probably suffering from perl&#39;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>
&gt;<br>
&gt;     Jian Zhu &lt;<a href="mailto:zhujian0805@gmail.com">zhujian0805@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;     Hello,<br>
&gt;<br>
&gt;     Could anyone please help me on this below issue?<br>
&gt;<br>
&gt;     my syslog-ng.conf file look like below:<br>
&gt;<br>
&gt;     The test.sh script work fine, I can see it&#39;s output in the test.sh.log<br>
&gt;     file.<br>
&gt;     But the <a href="http://test.pl" target="_blank">test.pl</a> doesn&#39;t work. the test.sh and <a href="http://test.pl" target="_blank">test.pl</a> have the same<br>
&gt;     function of printing something to STDOUT.<br>
&gt;     ------------------------------<br>
&gt;     -------------------------------------------------------------------------------------------------------------------<br>
&gt;     @version: 3.0<br>
&gt;     #Default configuration file for syslog-ng.<br>
&gt;     #<br>
&gt;     # For a description of syslog-ng configuration file directives, please read<br>
&gt;     # the syslog-ng Administrator s guide at:<br>
&gt;     #<br>
&gt;     # <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>
&gt;     bk01-toc.html<br>
&gt;     #<br>
&gt;     options {<br>
&gt;     # Number of syslog lines stored in memory before being written to files<br>
&gt;     flush_lines (0);<br>
&gt;     log_fifo_size (2048);<br>
&gt;     create_dirs (yes);<br>
&gt;     perm (0640);<br>
&gt;     dir_perm (0750);<br>
&gt;     };<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     source ppp { program(&quot;/root/perl/<a href="http://test.pl" target="_blank">test.pl</a>&quot;); };<br>
&gt;     destination ppp {<br>
&gt;     file (&quot;/var/log/syslog-ng/$HOST/perl.pl.log&quot; create_dirs(yes));<br>
&gt;     };<br>
&gt;     log {<br>
&gt;             source(ppp);<br>
&gt;             destination(ppp);<br>
&gt;     };<br>
&gt;<br>
&gt;     source sss { program(&quot;/root/shell/test.sh&quot;); };<br>
&gt;     destination sss {<br>
&gt;     file (&quot;/var/log/syslog-ng/$HOST/test.sh.log&quot; create_dirs(yes));<br>
&gt;     };<br>
&gt;     log {<br>
&gt;             source(sss);<br>
&gt;             destination(sss);<br>
&gt;     };<br>
&gt;     -------------------------------------------------------------------------------------------------------------------------------------------------<br>
&gt;<br>
&gt;<br>
&gt;     --<br>
&gt;<br>
&gt;     Thanks &amp; Best Regards<br>
&gt;<br>
&gt;     James Zhu<br>
&gt;<br>
&gt;     Mobile: <a href="tel:%2B86%20186%208482%202818" value="+8618684822818">+86 186 8482 2818</a><br>
&gt;<br>
&gt;     Email: <a href="mailto:zhujian0805@gmail.com">zhujian0805@gmail.com</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     ______________________________________________________________________________<br>
&gt;     Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
&gt;     Documentation: <a href="http://www.balabit.com/support/documentation/?product=" target="_blank">http://www.balabit.com/support/documentation/?product=</a><br>
&gt;     syslog-ng<br>
&gt;     FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt;<br>
&gt; Thanks &amp; Best Regards<br>
&gt;<br>
&gt; James Zhu<br>
&gt;<br>
&gt; Mobile: <a href="tel:%2B86%20186%208482%202818" value="+8618684822818">+86 186 8482 2818</a><br>
&gt;<br>
&gt; Email: <a href="mailto:zhujian0805@gmail.com">zhujian0805@gmail.com</a><br>
&gt;<br>
&gt;<br>
<br>
&gt; ______________________________________________________________________________<br>
&gt; Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
&gt; 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>
&gt; FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
&gt;<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 &amp; 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:&quot;Times New Roman&quot;,&quot;serif&quot;;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>