Solved

This is in RHEL 5.0 and AIX 5.3..Need a script

Posted on 2011-09-21
3
391 Views
Last Modified: 2012-05-12
This is in RHEL 5.0 and AIX 5.3..Need a script

I have a file in the location /home/ktabcd12/system.out.log

the system out.log gets appended as and we navigate the application

I need a scipt to look at Systemout.log every 15 mins and grep for
 
grep "** trying to find files for: ** took **" SystemOut.log >a.txt

cat a.txt

[9/21/11 17:23:24:130 GMT] 00000077 SystemOut     O com.app.doc.project.look.app.appInterface: trying to find files for: 403726 took 4893ms

[9/21/11 17:31:24:130 GMT] 00000077 SystemOut     O com.app.doc.project.look.app.appInterface: trying to find files for: 403726 took 5293ms

and from the file I need to look at  *ms and if the ms exceeds more than 10000 i.e if trying to find files for: 403726 took 10000ms or more

 ..I need to send an email saying an alert that  it is taking more tham 10000ms
0
Comment
Question by:aixtutorial
  • 2
3 Comments
 

Author Comment

by:aixtutorial
ID: 36575565
please provide a shell script for this
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36575704

#!/bin/bash

SYSTEM_OUT_FILE=/home/ktabcd12/system.out.log

grep 'trying to find files for:' $SYSTEM_OUT_FILE | awk '{print $(NF-2),$NF}' | sed 's/ms//g' | while read  FILE  TIME
do
  if [ $TIME -gt 10000 ]; then
    echo "File $file took more than 10000ms" | mail -s "$FILE slow"  <your email addres>
  fi
done

Open in new window

0
 
LVL 38

Accepted Solution

by:
wesly_chen earned 500 total points
ID: 36575715
Woo, type, lien 8 change to
echo "File $FILE took more than 10000ms" | mail -s "$FILE slow"  <your email addres>
#!/bin/bash

SYSTEM_OUT_FILE=/home/ktabcd12/system.out.log

grep 'trying to find files for:' $SYSTEM_OUT_FILE | awk '{print $(NF-2),$NF}' | sed 's/ms//g' | while read  FILE  TIME
do
  if [ $TIME -gt 10000 ]; then
    echo "File $FILE took more than 10000ms" | mail -s "$FILE slow"  <your email addres>
  fi
done

Open in new window

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now