Sponsored Content
Top Forums Shell Programming and Scripting script to grep outofmemory message in logs Post 302477673 by coolguyamy on Monday 6th of December 2010 06:25:59 AM
Old 12-06-2010
script to grep outofmemory message in logs

I have prepare script to grep for outofmemory messages in the logs. I need help in modifying script. I have implemented small logic. The outofmemory messages form six logs will store in variables.
Code:
 var1=`grep -i outofmemory $tomcat1logs  | sed -n '$p'| sed -n -e "s/.*\(outofmemory\).*/\1/p"`  
 var2=`grep -i outofmemory $tomcat2logs | sed -n '$p'| sed -n -e "s/.*\(outofmemory\).*/\1/p"`  
 var3=`grep -i outofmemory $tomcat3logs | sed -n '$p'| sed -n -e "s/.*\(outofmemory\).*/\1/p"`  
 var4=`grep -i outofmemory $tomcat4logs | sed -n '$p'| sed -n -e "s/.*\(outofmemory\).*/\1/p"`  
 var5=`grep -i outofmemory $tomcat5logs | sed -n '$p'| sed -n -e "s/.*\(outofmemory\).*/\1/p"`  
 var6=`grep -i outofmemory $tomcat6logs | sed -n '$p'| sed -n -e "s/.*\(outofmemory\).*/\1/p"`

My requirement is if there is an outofmmeory message in any of the varibale from above six. It should send the mail saying "there is an out outofmemory in tomcat1,tomcat2,tomcat3,tomcat4,tomcat5 or tomcat6 if it founds outofmemory invar1,var2,var3,var4,var5 or var6 respectively. Please help me to design the script for the above logic.Thanks in advance.

Last edited by jim mcnamara; 12-06-2010 at 08:26 AM.. Reason: code tags please
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Message Logs Error

I'm about 5 months new on an 5 year old unix system. If anyone can help me identify what causing the below errors i'd really appreciate it! unix: WARNING: /pci@1f,0/pci@1,1/ide@3/dad@1,0 (dad1): Uncorrectable data Error: Block 57e10 Unix: WARNING: /pci@1f,0/pci@1,1/ide@3/dad@1,0 (dad1):... (1 Reply)
Discussion started by: ByasB
1 Replies

2. UNIX for Advanced & Expert Users

ppp errror message in logs

I am getting this message in the log file. Apr 29 15:32:02 router ppp: Warning: Label COPYRIGHT rejected -direct connection: Configuration label not found This repeats every so often, the link is up however...Any ideas why i am getting this. Its freebsd 6.1 and pppoE. Frank (1 Reply)
Discussion started by: frankkahle
1 Replies

3. Shell Programming and Scripting

Grep logs on the fly

Hi, We use an application that is dumping logs to a file on disk. However, this is dumping very verbosely and there is no method of turning down the logging level. We need to remove certain contents from these before they are commited to disk. Has anybody got any ideas how I can do this... (3 Replies)
Discussion started by: harperonline
3 Replies

4. Shell Programming and Scripting

Grep yesterday logs from weblogic logs

Hi, I am trying to write a script which would go search and get the info from the logs based on yesterday timestamp and write yesterday logs in new file. The log file format is as follows: """"""""""""""""""""""""""... (3 Replies)
Discussion started by: harish.parker
3 Replies

5. Shell Programming and Scripting

Rotating logs in Perl without message loss

(I'm aware log rotation is a common subject, but I tried searching and couldn't find an answer) For some time now, I've been using the Logfile::Rotate module to rotate logs in a log-monitoring script. So far, I haven't experienced any problems, and it works great because I can use it in Linux... (1 Reply)
Discussion started by: w1r3d
1 Replies

6. Shell Programming and Scripting

script to grep latest outofmemory string from the logs

I have requirement to prepare script which will grep for latest outofmemory message from the logs. I have used following command to grep the string from the logs,this script is not effective when logs are not getting updated as it will grep for old message. f=catalina.out var=`tail -10 $f |... (17 Replies)
Discussion started by: coolguyamy
17 Replies

7. Shell Programming and Scripting

shell script to grep 500 error messages from access logs

Hello Team, I need help to improve my script which is used to grep 500 error messages in the logs. I am using following logic in the script to grep 500 error messages in the logs. var1=`awk '$9 == "500"' access_log | tail -1` The above logic is not useful if logs are not getting... (1 Reply)
Discussion started by: coolguyamy
1 Replies

8. Shell Programming and Scripting

Unable to get full message text from Windows Event Logs

Hi all, . I am developing a log monitoring solution in perl for Windows I am using the CPAN module Win32 ::EventLog (0.076) version for getting the events from windows. The problem which I am facing now is all the Windows 2008 machines are upgraded with Service pack2 from then I couldn’t able... (2 Replies)
Discussion started by: kar_333
2 Replies

9. Shell Programming and Scripting

Script to grep logs for Errors

Hi Guys, I want to write a script which can grep the logs (server.log) from a file for Error String and output to a other file. Problems: How to know about the errors only between the current restart and not in previous as server.log has earlier restarts also? thanks for the help! Much... (5 Replies)
Discussion started by: ankur328
5 Replies

10. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies
HOBBITD_FILESTORE(8)					      System Manager's Manual					      HOBBITD_FILESTORE(8)

NAME
hobbitd_filestore - hobbitd worker module for storing Xymon data SYNOPSIS
hobbitd_channel --channel=status hobbitd_filestore --status [options] hobbitd_channel --channel=data hobbitd_filestore --data [options] hobbitd_channel --channel=notes hobbitd_filestore --notes [options] hobbitd_channel --channel=enadis hobbitd_filestore --enadis [options] DESCRIPTION
hobbitd_filestore is a worker module for hobbitd, and as such it is normally run via the hobbitd_channel(8) program. It receives hobbitd messages from a hobbitd channel via stdin, and stores these in the filesystem in a manner that is compatible with the Big Brother daemon, bbd. This program can be started multiple times, if you want to store messages for more than one channel. OPTIONS
--status Incoming messages are "status" messages, they will be stored in the $BBLOGS/ directory. If you are using xymon(7) throughout your Xymon server, you will not need to run this module to save status messages, unless you have a third-party add-on that reads the sta- tus-logs directly. This module is NOT needed to get trend graphs, you should run the hobbitd_rrd(8) module instead. --data Incoming messages are "data" messages, they will be stored in the $BBDATA directory. This module is not needed, unless you have a third-party module that processes the data-files. This module is NOT needed to get trend graphs, you should run the hobbitd_rrd(8) module instead. --notes Incoming messages are "notes" messages, they will be stored in the $BBNOTES directory. This modules is only needed if you want to allow people to remotely update the notes-files available on the Xymon webpages. --enadis Incoming messages are enable/disable messages, they will update files in the $BBDISABLED directory. This is only needed if you have third-party add-ons that use these files. --dir=DIRECTORY Overrides the default output directory. --html Used together with "--status". Tells hobbitd_filestore to also save an HTML version of the status-log. Should not be used unless you must run with "BBLOGSTATUS=static". --htmldir=DIRECTORY The directory where HTML-versions of the status logs are stored. Default: $BBHTML --htmlext=.EXT Set the filename extension for generated HTML files. By default, HTML files are saved with a ".html" extension. --multigraphs=TEST1[,TEST2] This causes hobbitd_filestore to generate HTML status pages with links to service graphs that are split up into multiple images, with at most 5 graphs per image. If not specified, only the "disk" status is split up this way. --only=test[,test,test] Save status messages only for the listed set of tests. This can be useful if you have an external script that needs to parse some of the status logs, but you do not want to save all status logs. --debug Enable debugging output. FILES
This module does not rely on any configuration files. SEE ALSO
hobbitd_channel(8), hobbitd_rrd(8), hobbitd(8), xymon(7) Xymon Version 4.2.3: 4 Feb 2009 HOBBITD_FILESTORE(8)
All times are GMT -4. The time now is 12:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy