Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.unix.programmer > #582
| From | Tobias Blass <tobiasblass@gmx.net> |
|---|---|
| Newsgroups | comp.unix.programmer |
| Subject | Re: Tail -f with filter question |
| Date | 2011-05-17 09:59 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <iqtguv$ef8$3@dont-email.me> (permalink) |
| References | <4dd23b73$0$25748$c3e8da3$33881b6a@news.astraweb.com> |
On 2011-05-17, Matt Charles <mcharles48@gmail.com> wrote: > Hi folks, > > When testing I have a log file that I tail with: > > tail -f log.txt > > and watch the output. > > However there's some log entries that start with INFO that I don't > want to see (the rest are error messages that I am interested in > seeing). Is there way of filtering those out? > > I've tried this: > > tail -f log.txt | grep -v INFO > > but I think that's buffering and I don't get to see the error messages > when they are produced (in real time). > > Obviously I code write a C program to do this, but wasn't sure if > there was a better/easier way. > Do you use the syslog facility? If you do you could just change the rules in the syslog configuration file. It would also allow the users of your program to setup their own rules if they wish to do so. If you don't want to use syslog I found the following option for grep > --line-buffered Use line buffering on output. This can cause a > performance penalty. I guess grep uses block buffering by default, so line buffering should solve your problem
Back to comp.unix.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Tail -f with filter question Matt Charles <mcharles48@gmail.com> - 2011-05-17 10:09 +0100
Re: Tail -f with filter question pk <pk@pk.invalid> - 2011-05-17 10:27 +0100
Re: Tail -f with filter question Mc <spam.mc@gmail.com> - 2011-05-17 10:55 +0100
Re: Tail -f with filter question pk <pk@pk.invalid> - 2011-05-17 11:04 +0100
Re: Tail -f with filter question Tobias Blass <tobiasblass@gmx.net> - 2011-05-17 09:59 +0000
Re: Tail -f with filter question scott@slp53.sl.home (Scott Lurndal) - 2011-05-17 14:08 +0000
Re: Tail -f with filter question Nobody <nobody@nowhere.com> - 2011-05-18 07:55 +0100
Re: Tail -f with filter question Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2011-05-18 13:22 +0100
Re: Tail -f with filter question Damien Wyart <damien.wyart@free.fr> - 2011-05-17 16:36 +0200
Re: Tail -f with filter question James Waldby <not@valid.invalid> - 2011-05-17 18:22 +0000
Re: Tail -f with filter question Damien Wyart <damien.wyart@free.fr> - 2011-05-17 22:01 +0200
csiph-web