Sponsored Content
Top Forums Shell Programming and Scripting Calculating time windows from logfile timestamps Post 302670235 by danowar on Thursday 12th of July 2012 12:07:21 AM
Old 07-12-2012
Quote:
Originally Posted by methyl
Please post what Oparating System and version you are running and what Shell you prefer.

For anything to do with date arithmetic, please post whether you have the GNU date command and/or a modern version of perl.
Please also post sample data for a date from last week (i.e. with a single digit day).
Hi Methyl, thanks very much. Operating system is Red Hat Enterprise Linux Server release 5.5; I prefer the bash shell.

I do appear to have the GNU date command: the bottom of the date manpage shows it as 'date 5.97', and is dated February 2010.

A sample the log file in question:

cat application-logfile.log | grep "Application deployment complete."
[Jun 20, 2012 3:57:57 PM]: Application deployment complete.
[Jun 27, 2012 12:28:14 PM]: Application deployment complete.
[Jun 28, 2012 10:38:10 PM]: Application deployment complete.
[Jul 6, 2012 7:35:38 PM]: Application deployment complete.
[Jul 10, 2012 7:47:45 PM]: Application deployment complete.

(Single-digit days are not zero-padded, which is why I used %-d in my test date command).

Regarding Perl, if it is included by default in the RHEL 5.5 Server release, then I probably do; I really don't know anything at all about Perl, and sadly have tended to avoid it accordingly. I'm sure it's much easier to do all this with a Perl script, but that's a whole other can of worms I'm hesitant to open. =\

---------- Post updated at 11:07 PM ---------- Previous update was at 11:03 PM ----------

Quote:
Originally Posted by Chubler_XL
Can you take note of how many lines are in the logfile when the process starts and then look for the "Application deployment complete" message on a line greater than this?
I theoretically could, but I think that's a less reliable way to work in as a condition -- it is possible for a deployment activity here to be triggered manually outside the context of the actions my script is taking, which wouldn't necessarily interfere with the script's actions, but would mess up the deployment 'instance' counting if I did it this way, particularly considering the variable length and history of the application's log. Good idea, just impractical in this particular scenario -- I appreciate it, though!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

DiffElapsed time between unix timestamps help needed...

Does anyone know a perl script/utility/etc. to calculate the time in seconds between two unix time stamps? Any help will be appreciated. -bozzhawg (1 Reply)
Discussion started by: bozzhawg
1 Replies

2. UNIX for Advanced & Expert Users

Caluculate time between 2 unix timestamps?

Does anyone know a perl script/utility/etc. to calculate the time in seconds between two unix time stamps? Any help will be appreciated. -bozzhawg (1 Reply)
Discussion started by: bozzhawg
1 Replies

3. Shell Programming and Scripting

Calculating delay time - bash

Hi, I am having the following problem. test > hourOfDay=06 ; delayTime=$(((9-$hourOfDay)*60)) ; echo $delayTime 180 test > hourOfDay=07 ; delayTime=$(((9-$hourOfDay)*60)) ; echo $delayTime 120 test > hourOfDay=08 ; delayTime=$(((9-$hourOfDay)*60)) ; echo $delayTime bash: (9-08: value... (5 Replies)
Discussion started by: jbsimon000
5 Replies

4. Shell Programming and Scripting

Calculating completion time

The date construct in UNIX can be used to calculate when something is finished: date -v+1H displays the time 1 hour from now. I want to use the same construct in a script, but it is leading to error messages: echo "Finished at: " `date -v+$durationH` where $duration is calculated based on input... (3 Replies)
Discussion started by: figaro
3 Replies

5. AIX

How to find time difference between 2 timestamps?

HI All, can some one please help me how to fine the difference between two time stamps say a= Nov 10, 2009 9:21:25 AM b= Nov 10, 2009 10:21:25 AM I want to find difference between the a & b I googled and tried with some options but no luck. My OS is AIX (1 Reply)
Discussion started by: bandlan9
1 Replies

6. UNIX for Dummies Questions & Answers

Calculating the Hours between two time values

Dear Folks, I want to calculate the elapsed hours between two time columns. I am using timestampdiff method for the same. I am able to get the value. But facing an issue of decimal values. For example the elapsed hours between 09:00:00 and 20:30:00 is coming as 11 instead of 11.5. I am using below... (1 Reply)
Discussion started by: dinesh1985
1 Replies

7. Shell Programming and Scripting

Calculating the epoch time from standard time using awk and calculating the duration

Hi All, I have the following time stamp data in 2 columns Date TimeStamp(also with milliseconds) 05/23/2012 08:30:11.250 05/23/2012 08:30:15.500 05/23/2012 08:31.15.500 . . etc From this data I need the following output. 0.00( row1-row1 in seconds) 04.25( row2-row1 in... (5 Replies)
Discussion started by: ks_reddy
5 Replies

8. Shell Programming and Scripting

Compare two timestamps and print elapsed time

Hi, I am unable to Difference between two time stamps in Linux and display the total elapsed time . Source date: Aug 15, 2012 02:00:03 Target date: Aug 14, 2012 18:00:03 # based on the forums I am using the below function. Converted dates into this format Src_dt=20120814180003... (7 Replies)
Discussion started by: onesuri
7 Replies

9. Shell Programming and Scripting

Calculating the running time

Hi All, I want to run a utility for all the process id that are running for more than 15 mins. I have captured process id's and the time that they were run in a file like below 1st column represnts the process ids and the 2nd one is the Time < 21014 01:00 21099 01:00 24361 01:03 24406... (5 Replies)
Discussion started by: r_t_1601
5 Replies

10. Shell Programming and Scripting

Find time difference based on logfile

Hi All, Firstly thank you for the forum members I need to find time difference b'w two rows of timestamp using awk/shell. Here is the logfile: cat business_file start:skdjh:22:06:2010:10:30:22 sdfnskjoeirg wregn'wergnoeirnfqoeitgherg end:siifneworigo:22:06:2010:10:45:34... (3 Replies)
Discussion started by: Srinivas Gadi
3 Replies
CGI::Application::Plugin::DBIProfile::Graph::SVGTT(3pm) User Contributed Perl DocumentationCGI::Application::Plugin::DBIProfile::Graph::SVGTT(3pm)

NAME
CGI::Application::Plugin::DBIProfile::Graph::SVGTT - SVT::TT::Graph::Bar Graph output for CAP:DBIProfile. SYNOPSIS
# in httpd.conf SetVar CAP_DBIPROFILE_GRAPHMODULE CGI::Application::Plugin::DBIProfile::Graph::SVGTT PerlSetVar CAP_DBIPROFILE_GRAPHMODULE CGI::Application::Plugin::DBIProfile::Graph::SVGTT # in your CGI::Application subclass (needed to install callback) use CGI::Application; use CGI::Application::Plugin::DBIProfile::Graph::SVGTT; DESCRIPTION
This module provides a SVG::TT::Graph::Bars graphing option for CAP:DBIProfile. This also provides an example of non-inline graphs for DBIProfile. The following settings control the output: $CGI::Application::Plugin::DBIProfile::Graph::SVGTT::WIDTH Width of output image. $CGI::Application::Plugin::DBIProfile::Graph::SVGTT::HEIGHT Height of output image. REQUIREMENTS
SVG::TT::Graph SEE ALSO
SVG::TT::Graph::Bar CGI::Application::Plugin::DBIProfile CGI::Application::Plugin::DBIProfile::Graph::HTML AUTHOR
Joshua I Miller, L<unrtst@cpan.org> COPYRIGHT &; LICENSE Copyright 2007 Joshua Miller, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-11-10 CGI::Application::Plugin::DBIProfile::Graph::SVGTT(3pm)
All times are GMT -4. The time now is 08:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy