Re: [Hampshire] unwanted buffering of ssh output when piping…

Top Page

Reply to this message
Author: Victor Churchill
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] unwanted buffering of ssh output when piping into awk
2008/4/10 Ottavio Caruso <tat07x202@???>:
>
> Victor Churchill wrote:
>
> > I want to deconstruct the log file lines and reformat them for legibility.
> > So I pipe the stream coming from ssh into awk on my desktop machine.
> > When I try
> > ssh qq2 "tail -f /var/log/httpd/custom_log | awk '{printf (\"%9d %15s
> > %7s %s %60s\n\", \$NF, \$1, \$3, \$4, \$7)}' "
> > I see nothing at first, and then a burst of lines, then nothing, etc.
> > ...
> There's a perl script here:
> http://www.barracudanetworks.com/ns/downloads/BarracudaSyslog.pdf
>
> You can hack it and tailor it for your needs.
>


Thanks for the comment; however, my issue is not with processing the
lines ofthe log file. Rather, it is with the delay before the log file
lines become available for processing.

ssh someServer "tail -f blah_log" ==>
lines appear in terminal on my desktop immediately they are written on
the server.

ssh someServer "tail -f blah_log | awk '{doSomeStuff}' " ==>
lines appear in terminal on my desktop immediately they are written on
the server; each line is processed by awk script running on the
server.

ssh someServer "tail -f blah_log" | awk '{doSomeStuff}' ==>
somewhere in ssh, or in my bash or awk, data is buffered and only
appears on my terminal after it reaches 4K characters.

(I'm not sure how&why, but my OP lost its first paragraph expressing
the problem. GMail issue I suspect)