log wiever
Alexander Dalloz
alexander.dalloz at uni-bielefeld.de
Fri Feb 13 00:16:55 UTC 2004
Am Do, den 12.02.2004 schrieb Tommy Reynolds um 21:37:
> Uttered Alexander Dalloz <alexander.dalloz at uni-bielefeld.de>, spake thus:
>
> > Hey! You and Douglas are right. :)
>
> I don't mind people saying that I'm right, as long as they don't
> sound surprized ;-)
>
> > fiddled with that I not only wanted to combine tail -f with grep but to
> > let this run unattended and let the output redirect into a separate log
> > file. Something like:
> >
> > tail -f $LOGFILE | grep "$EXPRESSION" >> $GREPPED.LOGFILE
> >
> > This does not work. Or do you know a solution for that? I know there are
> > tools available for this task, to react on defined log events.
>
> How do you mean "doesn't work"? There's nothing broken here; that
> command line should be fine.
>
> Hmmm... what shell do you use?
I am a bash guy.
I played again with tail -f and grepping to a file. Now I had success
following your hint using --line-buffered. The specific command I used
now is:
tail -f /var/log/fetchmail.log | grep --line-buffered
"adalloz at mail.uni-bielefeld.de" >> fetch.log
which leads to log entries in fetch.log like:
fetchmail: reading message adalloz at mail.uni-bielefeld.de:1 of 5 (4749
header octets)
fetchmail: reading message adalloz at mail.uni-bielefeld.de:2 of 5 (3666
header octets)
...
Fine, fine. Sorry for my previous "does not work". I should have known
better to state a meaningful description. Before I always found a
touched but empty file to which I wanted to redirect the grepped output
of tail -f.
Thanks, I did learn from that.
Alexander
--
Alexander Dalloz | Enger, Germany | GPG key 1024D/ED695653 1999-07-13
Fedora GNU/Linux Core 1 (Yarrow) on Athlon CPU kernel 2.4.22-1.2149.nptl
Sirendipity 01:04:22 up 4 days, 3:46, load average: 0.13, 0.19, 0.17
[ Γνωθι σ'αυτον - gnothi seauton ]
More information about the fedora-list
mailing list