Parsing log file continuously


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Parsing log file continuously
# 1  
Old 02-12-2010
Parsing log file continuously

Hi

i have a log file, which keeps appending, i want to find "exceptions" in that log file and copy those exceptions to another file.

i am using

Code:
grep exception filename >> location where to copy

but as the file is appending, am not able to view.

i am using
Code:
tail -f command ,

pls guide me.

Last edited by zaxxon; 02-12-2010 at 11:52 AM.. Reason: edited subject and use code tags please, ty
# 2  
Old 02-12-2010
Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.

For members who want a higher visibility to their questions, we suggest you post in the Emergency UNIX and Linux Support Forum. This forum is given a higher priority than our regular forums.

Posting a new question in the Emergency UNIX and Linux Support Forum requires forum Bits. We monitor this forum to help people with emergencies, but we do not not guarantee response time or best answers. However, we will treat your post with a higher priority and give our best efforts to help you.

If you have posted a question in the regular forum with a subject "Urgent" "Emergency" or similar idea, we will, more-than-likely, close your thread and post this reply, redirecting you to the proper forum.

Of course, you can always post a descriptive subject text, remove words like "Urgent" etc. (from your subject and post) and post in the regular forums at any time.


Thank you.

The UNIX and Linux Forums
# 3  
Old 02-12-2010
Quote:
Originally Posted by rchaitanya
Hi

i have a log file, which keeps appending, i want to find "exceptions" in that log file and copy those exceptions to another file.

i am using

Code:
grep exception filename >> location where to copy

but as the file is appending, am not able to view.

i am using
Code:
tail -f command ,

pls guide me.
I hope this command should work..!
Code:
grep exception filename > location where to copy

Even though the file is getting appended , write time to file will have a gap.

Last edited by zaxxon; 02-12-2010 at 12:06 PM.. Reason: use code tags please
# 4  
Old 02-12-2010
You can try this, assuming that the logfile already exists and that the command opens the log file for append. This will first start a process that monitors the log file. Then you can start your command that appends to the logfile

Code:
tail -f existing log file name | grep exception >> location where to copy &
command


Last edited by pludi; 02-12-2010 at 05:08 PM.. Reason: almost. it's [code], not <code>
# 5  
Old 02-15-2010
New Bee to Unix

Hi

i am using

tail -f existing log file name | grep exception >> location where to copy

but the content is not copying to the location.

ex:
tail -f logfile | grep exception >> location of file.
# 6  
Old 02-15-2010
Quote:
Originally Posted by rchaitanya
Hi

i am using

tail -f existing log file name | grep exception >> location where to copy

but the content is not copying to the location.

ex:
tail -f logfile | grep exception >> location of file.
You can copy the file to any temp location. you can the use command as "tail -f logfile | grep -i exception >>/tmp/app.err &". Else you the copy the logfile to /tmp location , & you can view the execeptions.if your application is continously throwing the Exception to the logfile, in that case you will not be able to view the exceptions of the last minute .
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script for continuously monitoring log file

Hi I have written below log monitoring script to egrep multiple words and redirect the output to a text file and its working fine but I want to add some more below given functionality to it, which is very advance and im not very good in it, so please help if you can :) I am egrepping all the... (1 Reply)
Discussion started by: scazed
1 Replies

2. Shell Programming and Scripting

HELP on parsing this log file

Hi, I have a log file that looks like below and I am wanting to know if there is a better way of parsing it from how I am doing it right now. I am looking for when an application service is OFFLINE and ONLINE. This log file is getting written into every 30 minutes ... (1 Reply)
Discussion started by: newbie_01
1 Replies

3. Shell Programming and Scripting

Parsing Log File help

Hi, I am a newbie to scripting. I have multiple log files (saved as .gz) in a directory that looks like this 01-01-2013 10:00 pn: 123 01-01-2013 10:00 sn: 987 01-01-2013 10:00 Test1 01-01-2013 10:00 Result: Pass 01-01-2013 10:00 Time: 5:00 01-01-2013 10:00 Test2 01-01-2013 10:00... (3 Replies)
Discussion started by: linuxnew
3 Replies

4. Shell Programming and Scripting

Help Parsing a Log File

Hello all, I am new to scripting and I have written a script that performs an Rsync on my NAS and then moves on to send me an email with the status etc. The problem is that I think Rsync is taking to long to complete and the IF statement is timing out, as it doesn't appear to move on. Here... (1 Reply)
Discussion started by: Mongrel
1 Replies

5. Shell Programming and Scripting

Script for Parsing Log File

Working on a script that inputs an IP, parses and outputs to another file. A Sample of the log is as follows: I need the script to be able to input IP and print the data in an output file in the following format or something similar: Thanks for any help you can give me! (8 Replies)
Discussion started by: Winsarc
8 Replies

6. Shell Programming and Scripting

Continuously display the file name in vim

Hi All, In vim, when we press ^G, the file name is displayed at the bottom of the screen and as soon as we enter into some other mode (say e.g. Insert), the file name is replaced by the words "Insert". I was just wondering whether it is possible to continuously show the file name no matter which... (3 Replies)
Discussion started by: jal_capri
3 Replies

7. Shell Programming and Scripting

Shell Script to continuously scan a log file

Hello members, I have some doubts on how to write a script that can reports success / failure of a batch job ? 1. Run a batch job: 2. Wait and search for a particular string in the Log file: tail -f log01*.txt | egrep -v "^SUCCESSFUL" echo "continue with the other tasks" ... (1 Reply)
Discussion started by: novice82
1 Replies

8. UNIX for Dummies Questions & Answers

parsing a log file

I need help in parsing the following log files. 10 Apr 2009 0:16:16 * name: Tuna Belly Format: Well done, Price: 999 only 10 Apr 2009 0:16:16 * name: Roast Beef Format: Raw, Price: 55 c 10 Apr 2009 0:16:16 * name: Pasta Format: Dry, Price: 88.43 only etcetc I need to parse this... (8 Replies)
Discussion started by: izuma
8 Replies

9. UNIX for Dummies Questions & Answers

Script for parsing details in a log file to a seperate file

Hi Experts, Im a new bee for scripting, I would ned to do the following via linux shell scripting, I have an application which throws a log file, on each action of a particular work with the application, as sson as the action is done, the log file would vanish or stops updating there, the... (2 Replies)
Discussion started by: pingnagan
2 Replies

10. Shell Programming and Scripting

Parsing a Log file

Hi All, I'm deffently not a Unix specialist so be Gentel. I need to parse a Log file that looks like that: 2006-06-12 01:00:00,463 ERROR {cleanLoggersFiles} General Error comverse.compas.shared.exceptions.SystemParametersException: Error in reading parameter FileLocation at... (4 Replies)
Discussion started by: tbirenzweig
4 Replies
Login or Register to Ask a Question