Catching the exception in multiple logs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Catching the exception in multiple logs
# 1  
Old 09-03-2013
Wrench Catching the exception in multiple logs

Hi folks,

I have logs folder in which different type of logs are generated , I am monitoring them by the below command

Code:
tail -f *.log

but I want that if exception come in any of the logs then it should be catch so what i should prefix with
Code:
tail -f *.log

so that it imeediatley catches and high light he exception if it comes , Please advise Smilie

Last edited by vbe; 09-04-2013 at 10:26 AM..
# 2  
Old 09-03-2013
You can use
Code:
grep -il <string you want to search for> *

or
Code:
grep -ic <string you want to search for> *


Last edited by Don Cragun; 09-03-2013 at 01:33 AM.. Reason: Use CODE tags; not bold font to display code.
# 3  
Old 09-03-2013
this would print everything and highlight the line containing the word "EXCEPTION"

Code:
tail -f *.log | awk '{ x=$0; if(/EXCEPTION/){ x= "\033[1;31m" $0 "\033[0m" } print x}'

replace EXCEPTION with the exception text you want to match against
# 4  
Old 09-04-2013
this is giving an Exception...!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Searching exception keyword in all logs in last 5 minutes

Hello Folks , I am a new bie to the world of unix , what i am planning to do is the I have the location in server to which i am access through the putty and the location is /mt/ttlog/avccomn/logs/201901/19 and at this location the files are listed as show startjmsnode1.sh_03.out... (7 Replies)
Discussion started by: punpun26262626
7 Replies

2. Shell Programming and Scripting

Combine logs span across multiple lines

Hi All, I am having a log file ERROR 2016-12-08 10:22:23.542 some data **** some data****** **** some data****** **** some data****** DEBUG 2016-12-08 10:23:23.542 some data **** some data****** **** some data****** **** some data****** when i grep the log file with ERROR am getting... (3 Replies)
Discussion started by: mohanalakshmi
3 Replies

3. Shell Programming and Scripting

Search patterns in multiple logs parallelly.

Hi All, I am starting a service which will redirect its out put into 2 logs say A and B. Now for succesful startup of the service i need to search pattern1 in log A and pattern2 in log B which are writen continuosly. Now my requirement is to find the patterns in the increasing logs A and B... (19 Replies)
Discussion started by: Girish19
19 Replies

4. Shell Programming and Scripting

Shell Script for viewing multiple logs from multiple server

I am new to Shell scripting and below is my requirement. I need to search some specific word e.g. "exception" or "transaction" from log file. We have multiple env e.g. Level1 , Level2 etc and each env have Multiple boxes e.g. For Level 1 env we have "test11.test.com" , "test12.test.com". Each... (1 Reply)
Discussion started by: peeyush
1 Replies

5. Shell Programming and Scripting

Line numbers and exception to be caught in logs

Hi Folks, I have just basic queries is that suppose I have to monitor the logs then there is a command , suppose I have to monitor the abc.log which is updating dynamically within seconds so the command will be after going to that directory is .. tail -f abc.log Now please advise what about... (1 Reply)
Discussion started by: punpun66
1 Replies

6. Shell Programming and Scripting

Monitor logs for exception and if exception come then sent an email

Hi Folks, please advise , I have logs generated on unix machine at location /ops/opt/aaa/bvg.log , now sometimes there come exception in these logs also, so I want to write such a script such that it should continuously monitor these logs and whenever any exception comes that is it try to find... (3 Replies)
Discussion started by: tuntun27272727
3 Replies

7. Shell Programming and Scripting

Catching exception of commands executed under ssh and su

Hello experts, I have one wrapper script which runs on server104, the purpose of the script is to ssh on server109; perform su to application user; and execute exports script. I want wrapper script to stop executing further if my exports script comes out with exit 1. My current setup keeps on... (3 Replies)
Discussion started by: avikaljain
3 Replies

8. Shell Programming and Scripting

FTP GET with exception handeling and multiple conditions

Thanks everyone for the wonderful and helping environment.. And the problem I asked.. forget it... 4 days wait for a decent reply was such a moral booster.. (3 Replies)
Discussion started by: ReignOfChaos
3 Replies

9. Shell Programming and Scripting

compressing logs on multiple servers/modules

Hi, I have 3 servers and 8 modules on each server with log files. The path is something like: /path/(server)/app/(module) the logs file are already in a file format of server.log.* on all modules. To compress the modules i will be using find . -name "server.log.*" -exec gzip {} \; and... (1 Reply)
Discussion started by: acc01
1 Replies

10. Programming

exception vs. multiple-thread

Some questions regarding exception vs. multiple-thread : 1. there are one main thread and one child thread. the child thread may throw one exception but it doesn't try to catch any exception. in the main thread, it tries to catch excpetion. Can main thread catch the exception that is thrown... (1 Reply)
Discussion started by: princelinux
1 Replies
Login or Register to Ask a Question