[syslog-ng]Using a perl script with the pipe destination driver

Jim Mozley syslog-ng@lists.balabit.hu
Wed, 28 Apr 2004 12:03:41 +0100


Loic Minier wrote:

>Jim Mozley <jim.mozley@exponential-e.com> - Tue, Apr 27, 2004:
>
>  
>
>>   my @lines = <PIPE>;
>>   for ( @lines ) {
>>      # do some stuff
>>   }
>>    
>>
>
> This causes reading until the End Of File of PIPE, then you process all
> lines.
>
> Instead, I suggest you try:
>
>     while ( <PIPE> ) {
>        # do some stuff
>     }
>
> [ Syslog-NG opens a pipe to your program when it is started and closes
> it when it's stopped.  It doesn't open a new pipe for each log line. ]
>  
>

Thanks, I understood this was the case for a pipe as in two commands 
with a | but didn't know it kept a fifo open too. Should have guessed 
this from the behaviour.

Thanks,

Jim Mozley