LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to highlight Exception and failure in server.log file (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-highlight-exception-and-failure-in-server-log-file-929049/)

mikey_choudhary 02-13-2012 12:27 AM

How to highlight Exception and failure in server.log file
 
Hi guys, I wanna highlighted display of some keywords like EXCEPTIONS and Failures in log file as it keep running.
thanxx

EricTRA 02-13-2012 12:43 AM

Hello and welcome to LinuxQuestions,

You could install colortail (most likely exists in your repositories) or multitail.

Looking forward to your participation in the forums. Have fun with Linux.

Kind regards,

Eric

mikey_choudhary 02-13-2012 01:51 AM

I can't install anything as i m not superuser. what I am asking is, when I am monitoring server.log, there are thousands of request processing every seconds so I just want to monitor only failures n exceptions occurred.
when I do " cat server.log " or
" tail -f server.log "
it continually display all requests
but i want it to display only lines that containing Exception or errors
i don't want use grep or seek like commands because it doesn't display continuously...grep doesn't update automatically.

chrism01 02-13-2012 11:00 PM

This will do it
Code:

tail -f server.log|grep -E "failure|exception"
The tail cmd continuously feeds grep which only displays matched recs.
Note that its all case sensitive, so failure != Failure.

catkin 02-13-2012 11:59 PM

Quote:

Originally Posted by chrism01 (Post 4601754)
Note that its all case sensitive, so failure != Failure.

grep's -i (or --ignore-case) option would solve that. Might be useful to add error to failure and exception.

mikey_choudhary 02-14-2012 12:15 AM

Quote:

Originally Posted by chrism01 (Post 4601754)
This will do it
Code:

tail -f server.log|grep -E "failure|exception"
The tail cmd continuously feeds grep which only displays matched recs.
Note that its all case sensitive, so failure != Failure.

Thanks man...this is what i was looking exactly.
keep it up.


All times are GMT -5. The time now is 02:45 PM.