Thanks you Evan for you quick response. I changed my script as below and now it&#39;s working fine.<br><br>#!/usr/bin/perl<br><br>$i=0;<br>while(true){<br>        $i++;<br><i>        #added below 2 lines to force a flush right away and after every print<br>
        #according to perl document: &quot;STDOUT will typically be line buffered if
output is to the terminal and block buffered otherwise.&quot;<br>        #since the output is not to terminal so here it&#39;s block buffered, i guess this is the root cause.</i><br><span style="color:rgb(51,51,255)">        select(STDOUT);</span><br style="color:rgb(51,51,255)">
<span style="color:rgb(51,51,255)">        $| = 1;</span><br style="color:rgb(0,0,102)"><br>        print STDOUT &quot;hello $i\n&quot;;<br><br>        sleep 1;<br><br>}<br><br><br><br><br><br><div class="gmail_quote">On Fri, Aug 10, 2012 at 8:52 AM, Evan Rempel <span dir="ltr">&lt;<a href="mailto:erempel@uvic.ca" target="_blank">erempel@uvic.ca</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>
<pre style="font-size:10.0pt;font-family:Tahoma;word-wrap:break-word">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. 

Jian Zhu &lt;<a href="mailto:zhujian0805@gmail.com" target="_blank">zhujian0805@gmail.com</a>&gt; wrote:

</pre><div><div class="h5">
<div>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&#39;s output in the test.sh.log file.<br>
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 function of printing something to STDOUT.<br>
------------------------------
<div>-------------------------------------------------------------------------------------------------------------------<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/bk01-toc.html" target="_blank">
http://www.balabit.com/dl/html/syslog-ng-admin-guide_en.html/bk01-toc.html</a><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(&quot;/root/perl/<a href="http://test.pl" target="_blank">test.pl</a>&quot;); };<br>
destination ppp {<br>
file (&quot;/var/log/syslog-ng/$HOST/perl.pl.log&quot; create_dirs(yes));<br>
};<br>
log {<br>
        source(ppp);<br>
        destination(ppp);<br>
};<br>
<br>
source sss { program(&quot;/root/shell/test.sh&quot;); };<br>
destination sss {<br>
file (&quot;/var/log/syslog-ng/$HOST/test.sh.log&quot; create_dirs(yes));<br>
};<br>
log {<br>
        source(sss);<br>
        destination(sss);<br>
};<br>
-------------------------------------------------------------------------------------------------------------------------------------------------</div>
<br clear="all">
<br>
-- <br>
<p><b><a name="1390e0525cb76ebe_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;"></span></span></p>
<p><span><b><span style="font-size:10pt">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>
</div>
</div></div></div>

<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></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>