Sponsored Content
Top Forums Shell Programming and Scripting Searching Error Message from a log life between timestamp of every 10 minutes Post 302880218 by ctscbe on Wednesday 18th of December 2013 07:56:18 AM
Old 12-18-2013
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,
Code:
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 syntex,but nothing is displaying(no output)Smilie
Can anyone help me find the write solution pls.Smilie
Thanks in advanceSmilie

---------- Post updated at 06:26 PM ---------- Previous update was at 05:56 PM ----------

Code:
if [ $2>="$(date -d '45 minutes ago' "+%H:%M:%S")" ];
then 
echo "found"
{print $0}
else 
echo " not found"
fi < filename


output:
Code:
not found:(



can anyone help me soon...with ur valuable ideas

Last edited by Don Cragun; 12-19-2013 at 02:31 AM.. Reason: Font and Size changes deleted; CODE tags added.
 

8 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

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... (2 Replies)
Discussion started by: new2ss
2 Replies

3. UNIX for Advanced & Expert Users

End of Life / Life Cycle Information

Hello everyone, I was searching for locations where I can get End of Life information on multiple versions of Unix. I have found some information which I list below, what I have not found or confirmed is where I can get the information for: DEC Unix/OSF1 V4.0D NCR Unix SVR4 MP-RAS Rel 3.02.... (2 Replies)
Discussion started by: robertmcol
2 Replies

4. 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

5. UNIX for Beginners Questions & Answers

How to convert days hours minutes seconds to minutes?

Hi, please help with below time conversion to minutes. one column values: 2 minutes 16 seconds 420 msec 43 seconds 750 msec 0 days 3 hours 29 minutes 58 seconds 480 msec 11 seconds 150 msec I need output in minutes(total elapsed time in minutes) (2 Replies)
Discussion started by: ramu.badugula
2 Replies

6. UNIX for Beginners Questions & Answers

Searching exception keyword in all logs in last 5 minutes

Hello Folks , I am a new bie to the world of unix , what i am planning to do is the I have the location in server to which i am access through the putty and the location is /mt/ttlog/avccomn/logs/201901/19 and at this location the files are listed as show startjmsnode1.sh_03.out... (7 Replies)
Discussion started by: punpun26262626
7 Replies

7. Shell Programming and Scripting

Grep a log file for the last 5 minutes of contents every 5 minutes

Hi all, System Ubuntu 16.04.3 LTS i have the following log INFO 2019-02-07 15:13:31,099 module.py:700] default: "POST /join/8550614e-3e94-4fa5-9ab2-135eefa69c1b HTTP/1.0" 500 2042 INFO 2019-02-07 15:13:31,569 module.py:700] default: "POST /join/6cb9c452-dcb1-45f3-bcca-e33f5d450105... (15 Replies)
Discussion started by: charli1
15 Replies

8. UNIX for Beginners Questions & Answers

How to get last 15 minutes timestamp and threshold > 60 will sent alert?

Hi All, need your help , i have some files and got some below condition cat tdr12009.log | grep -i success | grep promo | awk -F'' '{print substr($1,1,16),$15}' | more 2019-10-16 00:03 delta=1 2019-10-16 00:03 delta=2 2019-10-16 00:04 delta=20 2019-10-16 00:09 delta=10 2019-10-16... (5 Replies)
Discussion started by: fajar_3t3
5 Replies
Log::Message::Handlers(3pm)				 Perl Programmers Reference Guide			       Log::Message::Handlers(3pm)

NAME
Log::Message::Handlers - Message handlers for Log::Message SYNOPSIS
# Implicitly used by Log::Message to serve as handlers for # Log::Message::Item objects # Create your own file with a package called # Log::Message::Handlers to add to the existing ones, or to even # overwrite them $item->carp; $item->trace; DESCRIPTION
Log::Message::Handlers provides handlers for Log::Message::Item objects. The handler corresponding to the level (see Log::Message::Item manpage for an explanation about levels) will be called automatically upon storing the error. Handlers may also explicitly be called on an Log::Message::Item object if one so desires (see the Log::Message manpage on how to retrieve the Item objects). Default Handlers log Will simply log the error on the stack, and do nothing special carp Will carp (see the Carp manpage) with the error, and add the timestamp of when it occurred. croak Will croak (see the Carp manpage) with the error, and add the timestamp of when it occurred. cluck Will cluck (see the Carp manpage) with the error, and add the timestamp of when it occurred. confess Will confess (see the Carp manpage) with the error, and add the timestamp of when it occurred die Will simply die with the error message of the item warn Will simply warn with the error message of the item trace Will provide a traceback of this error item back to the first one that occurred, clucking with every item as it comes across it. Custom Handlers If you wish to provide your own handlers, you can simply do the following: o Create a file that holds a package by the name of "Log::Message::Handlers" o Create subroutines with the same name as the levels you wish to handle in the Log::Message module (see the Log::Message manpage for explanation on levels) o Require that file in your program, or add it in your configuration (see the Log::Message::Config manpage for explanation on how to use a config file) And that is it, the handler will now be available to handle messages for you. The arguments a handler may receive are those specified by the "extra" key, when storing the message. See the Log::Message manpage for details on the arguments. SEE ALSO
Log::Message, Log::Message::Item, Log::Message::Config AUTHOR
This module by Jos Boumans <kane@cpan.org>. Acknowledgements Thanks to Ann Barcomb for her suggestions. COPYRIGHT
This module is copyright (c) 2002 Jos Boumans <kane@cpan.org>. All rights reserved. This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-01-06 Log::Message::Handlers(3pm)
All times are GMT -4. The time now is 11:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy