never mind I mssed the bottom part

> -----Original Message-----
> From: Chris Bennett [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, August 02, 2000 6:25 PM
> To:   'Marc Mutz'; Alvaro M. Piffaretti
> Cc:   [EMAIL PROTECTED]
> Subject:      RE: Colorizing of logs.
> 
> hmm how does this script determine if dangerous?
> 
> > -----Original Message-----
> > From:       Marc Mutz [SMTP:[EMAIL PROTECTED]]
> > Sent:       Wednesday, August 02, 2000 5:38 PM
> > To: Alvaro M. Piffaretti
> > Cc: [EMAIL PROTECTED]
> > Subject:    Re: Colorizing of logs.
> > 
> > "Alvaro M. Piffaretti" wrote:
> > > 
> > > Hi all,
> > > I usually have at minimum one log on my X desktop. What I have is an
> > > xterm
> > > window positioned on one corner and sized to a comfortable size,
> > > launched
> > > from an icon on my desktop.The xterm window runs a "tail -f ..." to
> > > which one of my /var/log/file I'm interested on.
> > > I am wondering, does anyone have an idea on how to colorize these logs
> > > ?. I mean it would be great to have red color for messages like:
> > > 
> > > "in.telnetd[2330]: connect from [EMAIL PROTECTED]"
> > > 
> > > for example, and green color for normal informative messages.
> > > Am I dreaming, or is it possible ?
> > > 
> > <snip>
> > 
> > Of course! Try something along the following script:
> > --begin script--
> > #!/bin/bash
> > 
> > # a few macros to handle color escape sequences:
> > red_on () { echo -ne '\033[31m' }
> > green_on () { echo -ne '\033[32m' }
> > yellow_on () { echo -ne '\033[33m' }
> > bold_on () { echo -ne '\033[1m' }
> > extras_off () { echo -ne '\033[m' }
> > 
> > # replace /var/log/messages with "$1" to be
> > # able to give the desired filename as a arg
> > # to this script
> > tail --follow /var/log/messages | \
> > while read line; do
> >     if dangerous "$line"; then
> >             red_on
> >             bold_on
> >     else
> >             green_on
> >     fi
> >     echo "$line"
> >     extras_off
> > done
> > --end script--
> > 
> > 'dangerous' can be a shell function to be defined above the while loop
> > or any other executable that takes a string as an argument and exits
> > sucessfully when the string contains information that should be printed
> > in red. What that information is, is up to you, so you must write
> > 'dangerous' yourself.
> > 
> > Then start your xterm with 'xterm -e /path/to/script file_to_watch' (if
> > you used "$1" above).
> > 
> > This is untested, but straightforward. The escape codes are taken from
> > SuSE's /etc/rc.config file and may not work for all terminal types. The
> > right way would be to consult termcap, but then you need C, no?
> > 
> > Marc
> > 
> > 
> > 
> > -- 
> > Marc Mutz <[EMAIL PROTECTED]>        http://marc.mutz.com/Encryption-HOWTO/
> > University of Bielefeld, Dep. of Mathematics / Dep. of Physics
> > 
> > PGP-keyID's:   0xd46ce9ab (RSA), 0x7ae55b9e (DSS/DH)
> > 
> > 
> > 
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-newbie"
> in
> > the body of a message to [EMAIL PROTECTED]
> > Please read the FAQ at http://www.linux-learn.org/faqs
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to [EMAIL PROTECTED]
> Please read the FAQ at http://www.linux-learn.org/faqs

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to