Sponsored Content
Top Forums Shell Programming and Scripting Fishing out error message within a log file Post 302078399 by new2ss on Friday 30th of June 2006 04:15:16 AM
Old 06-30-2006
Fishing out error message within a log file

Hi all,

i have a log file that captures success or failure messges when i run a daily job.
here is a sample of my log.

20060312 start
successful
successful
failure
failure
20060312 end

i need to write a subroutine that opens up the log daily after my job completes to examine the log and if there are failures alert me.
Code:
##########
script that perform the job. print out current time,records success or failure. when job ends, 
print out time when job started. 
###########
a small routine to open up the log, 
count number of times 'failure' appears demarked by the start and
end text and if count >1 email myself with the lines of failure.

how can i do it in perl? i am thinking along the line of storing the start and end line in two variables, open up the log, filter out the chunk of lines within the 2 variables and do a count. Any suggestions?
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Append error message to the log

In my unix system , I chceck that there are error message append to the /var/adm/syslog . But I also found that part of these message will pop to my login session ( I use telent to login to server ) , I also check the /var/mail/my_loginid is empty , could suggest how can I forbid the message pop to... (1 Reply)
Discussion started by: ust
1 Replies

2. Shell Programming and Scripting

Send-file /var/log/message

Hello All i need Shell Script to send /var/log/message or another if he have or grep this file to have some info like PID or value (e.g like NFS mount - stop ) to some body in my System Thanks for Advanced (2 Replies)
Discussion started by: Hosam
2 Replies

3. UNIX for Dummies Questions & Answers

error message when use fork with open file

I get this message when I write myshell.c program "VM pagefault:SIGSEGV bad add 0x0 err 0x4 nopage read myshell PM: ciredump signal 11 for 1725 /myshell memory fault (core dumped)" /* RCS information: $Id: myshell.c,v 1.2 2006/04/05 22:46:33 elm Exp $ */ #include <stdio.h> #include <unistd.h>... (1 Reply)
Discussion started by: rosecomp
1 Replies

4. Shell Programming and Scripting

Help w/ script to read file and parse log message

Hi, I am working on the script to parsing the specific message like "aaaa" in multiple log files like N1-***,N2-***,N3-***... The script is to find the list of lof files which contains the message "aaaa" and export the list into excel filE. Can anyone give help? Thanks (2 Replies)
Discussion started by: shyork2001
2 Replies

5. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

6. Shell Programming and Scripting

Extract XML message from a log file using awk

Dear all I have a log file and the content like this file name: temp.log <?xml version="1.0" encoding="cp850"?> <!DOCTYPE aaabbb SYSTEM '/dtdpath'> <aaabbb> <tranDtl> <msgId>000001</msgId> </tranDtl> ..... </aaabbb> ... ... (1 Reply)
Discussion started by: on9west
1 Replies

7. UNIX for Dummies Questions & Answers

Cp problems, file exists but error message

Basically, I want to copy all files (F03*) in this directory and merge/paste them into a new file (called SMER_2.03.12.SPU), yet the error message is "no such file or directory." I listed what is in my working directory, and the files do exist, so I'm not sure what's going on. The code's at the... (8 Replies)
Discussion started by: ucsdee
8 Replies

8. Shell Programming and Scripting

Searching Error Message from a log life between timestamp of every 10 minutes

HI Everyone, My task is to search error messages last 10 minutes everytime from a log file. My script, date1=`date -d '10 minutes ago' "+%H:%M:%S"` date2=`date "+%H:%M:%S"` awk -v d1="${date1}" -v d2="${date2}" '$0~d1{p=1} $0~d2{p=0} p' filename No error getting in... (3 Replies)
Discussion started by: ctscbe
3 Replies

9. UNIX for Beginners Questions & Answers

Colorful message is displayed in the terminal but not in the log file

Is there any way to print the colorful message in the terminal (which is the output of a simulation) to the log file with the same color. The colorful message at the terminal is obtained by the following codes: /////////////codes start here/////////////////////////////////////// ... (5 Replies)
Discussion started by: babunp114525
5 Replies
FAILLOG(8)																FAILLOG(8)

NAME
faillog - display faillog records or set login failure limits SYNOPSIS
faillog [options] DESCRIPTION
faillog formats the contents of the failure log from /var/log/faillog database. It also can be used for maintains failure counters and limits. Run faillog without arguments display only list of user faillog records who have ever had a login failure. OPTIONS
The options which apply to the faillog command are: -a, --all Display faillog records for all users. -h, --help Display help message and exit. -l, --lock-time SEC Lock accout to SEC seconds after failed login. -m, --maximum MAX Set maiximum number of login failures after the account is disabled to MAX. Selecting MAX value of 0 has the effect of not placing a limit on the number of failed logins. The maximum failure count should always be 0 for root to prevent a denial of services attack against the system. -r, --reset Reset the counters of login failures or one recor if used with -u LOGIN option. Write access to /var/log/faillog is required for this option. -t, --time DAYS Display faillog records more recent than DAYS. The -t flag overrides the use of -u. -u, --user LOGIN Display faillog record or maintains failure counters and limits (if used with -l, -m or -r options) only for user with LOGIN. CAVEATS
faillog only prints out users with no successful login since the last failure. To print out a user who has had a successful login since their last failure, you must explicitly request the user with the -u flag, or print out all users with the -a flag. FILES
/var/log/faillog failure logging file SEE ALSO
login(1), faillog(5) AUTHOR
Julianne Frances Haugh (jockgrrl@ix.netcom.com) 08/03/2005 FAILLOG(8)
All times are GMT -4. The time now is 02:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy