monitor log files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting monitor log files
# 1  
Old 03-08-2010
monitor log files

Hello,

I want something like this

Code:
tail -f /a/b/c/*.log | grep -i "STRING1|STRING2 " > a.txt

I want to check all the log files in a particular directory then grep if any of the log files have "STRING1" and "STRING2" string and then have to send email to the group.

Platform is HP-UX

it can be a shell or perl script.

Thanks in advance.

Last edited by RTY; 03-08-2010 at 11:49 AM.. Reason: Please use code tags!
# 2  
Old 03-08-2010
uxtail HP-UX

Quote:
Originally Posted by RTY
Hello,

I want something like this

Code:
tail -f /a/b/c/*.log | grep -i "SYSTEM ERROR | ERROR " > a.txt

I want to check all the log files in a particular directory then grep if any of the log files have "SYSTEM ERROR" and "ERROR" string and then have to send email to the group.

Platform is HP-UX

it can be a shell or perl script.

Thanks in advance.
Hello,

is uxtail available at your HP-UX system?

uxtail ?

/opt/uxt/.....

From swlist:
uxt -> 2.1 uxt

Regards

Regards
# 3  
Old 03-08-2010
no it is not being installed.....
# 4  
Old 03-08-2010
Maybe you can use logmon?

The Wandering Geek : /monitoring-and-alerting-on-linux-logfiles.html

or logwatch?

http://mathias-kettner.de/checkmk_logfiles.html

Last edited by jostber; 03-08-2010 at 10:36 AM..
# 5  
Old 03-08-2010
I have already seen this but no success.....Smilie Smilie is there any other way to do the same?
# 6  
Old 03-08-2010
Your proposed script will only look at the first file matching the pattern /a/b/c/*.log .

Are you trying to monitor these logs in real time?

How many different logs are involved?

How large are these logs? Kilobytes, Megabytes, Gigabytes?

What is an acceptable delay between the error message "STRING1" or "STRING2" appearing in a log and the error email being sent?

My usual approach is to set up a cron job to examine a log at fixed time intervals to record events and report any new events.
# 7  
Old 03-09-2010
The code snippet is just; what i am looking for. It is not a working piece because i am not able to redirect the grep thing into a file.

1) I want to search for both the string "STRING1" and "STRING2". If any of the strings is present in any of the logs immediately it should send an e-mail.

2) There will be approximately 60 log files.

3) Log files will be of size 2 MB approx.

4) Error message depends upon some application failure.

5) Yes, if script is done then I can run it in cron job.

Regards,
RTY
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Monitor log when Process comes UP

Hi, I need to grep a pattern in the log file of a process and send a mail if pattern found.But I am not able to figure out how do I detect when the process comes UP,it is started several times a day and each time it is started I need to perform this action. Please suggest something. (3 Replies)
Discussion started by: vishal bhargava
3 Replies

2. Shell Programming and Scripting

Monitor log entries in log files with no Date format? - Efficient logcheck?

is there a way to efficiently monitor logfiles that do not have a date or time format? i have several logs on several different servers that need to be monitored. but i realized writing a script for this would be very complex and time consuming giving the variety of things i need to check for i.e.... (2 Replies)
Discussion started by: SkySmart
2 Replies

3. Shell Programming and Scripting

Monitor log file

Hi, I need to amend an existing ksh script so that it runs a process (stop weblogic) and in parallel needs to monitor a log file (startup.log) in the background for a certain string (e.g. unable to stop weblogic). If the string appears in the log i need to kill the stop weblogic process. ... (5 Replies)
Discussion started by: dholmaster
5 Replies

4. HP-UX

Script to monitor /var/opt/resmon/log/event.log file

AM in need of some plugin/script that can monitor HP-UX file "/var/opt/resmon/log/event.log" . Have written a scrip in sh shell that is working fine for syslog.log and mail.log as having standard format, have interrogated that to Nagios and is working as I required . But same script failed to... (3 Replies)
Discussion started by: Shirishlnx
3 Replies

5. Homework & Coursework Questions

shell script that can create, monitor the log files and report the issues for matching pattern

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write an automated shell program(s) that can create, monitor the log files and report the issues for matching... (0 Replies)
Discussion started by: itian2010
0 Replies

6. Shell Programming and Scripting

Write an automated shell program(s) that can create, monitor the log files and report the issues for

Hi , Please help me getting this done. Write an automated shell program(s) that can create, monitor the log files and report the issues for matching pattern. (i) Conditions for creating log files. Log file is created with date (example 2010_03_27.log). If the log file size is 10 Mb for... (1 Reply)
Discussion started by: itian2010
1 Replies

7. UNIX for Dummies Questions & Answers

Monitor files

I have just started UNIX administration..I want to monitor files with a specific extensions.. ie, I want to monitor .doc or .DOC files created in particular directory..The script should display (every minute) a list of those filenames created after the previous display. (1 Reply)
Discussion started by: aadi_uni
1 Replies

8. Shell Programming and Scripting

Need help for this monitor log script

this is the format of the log file in my system xxxxx_xxx_xxxx_xxxxx_09_10_2009_170457.log xxxx_xxx_2_0_09_10_2009_163834.log xxx_xxxxxxxxx_25_10_2009_045020.log xxx_xxxxxxx_08_11_2009_055728.log the path of this logs file in on for example /dellxmax/application/log what i want to do... (5 Replies)
Discussion started by: coxmanchester
5 Replies

9. UNIX for Dummies Questions & Answers

Log monitor script

Hi All, I have a question and hope someone will have an answer to that. I'm looking for a way to monitor log files being generated on a windows machine for some specified string and if its occurrence is found, raise an alarm though email. The log file size keeps on increasing and after a... (2 Replies)
Discussion started by: er_ashu
2 Replies

10. Shell Programming and Scripting

need help doing a script to monitor if files are go through

I am trying to do a shell script to check a folder and see if files are passing through. Now if a file did not pass through in the last 1 hour send an email. ftp----------> folder to monitor ----------->ftp Now the script that moves the file runs every sec in cron, so i do not know if i... (0 Replies)
Discussion started by: jonathan184
0 Replies
Login or Register to Ask a Question