Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script to search log file for last 15 mins data Post 302956794 by methyl on Saturday 3rd of October 2015 08:09:52 PM
Old 10-03-2015
Quote:
I strongly suggest that instead of trying to match based on timestamps you instead keep track of the line number of the last line processed in the previous run and on the next run just start processing with the next line in that log file. Doing it this way will keep you from missing events and keep you from processing some events twice.
Furthur to Don_Cragun, and if I have understood the task correctly.

You need a script running under cron every 15 minutes which copies the current logfile and compares the line count with the previous version of the logfile. The script then processes the "tail -#" number of lines difference.

This is a basic technique to avoid "tail -f" on logfiles which will get deleted by log rotation scripts. It also avoids reading the logfile and processing all the timestamps in the logfile.

Don't forget the "first time" condition when the T-15 minutes copy does not exist. Your first run of the cron will just prepare the files.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell-script which extract data from log file

give me a shell-script which extract data from log file on a server by giving date and time as input (for both start time and end time) and it will give the logs generated during the given time as output. (4 Replies)
Discussion started by: abhishek27
4 Replies

2. Shell Programming and Scripting

{How} Script to search a log file for a given criteria

I have to write a script to search the logfiles i.e msg.log for the following The Search Criteria is as follows 1. IP address 2. String Ex: abc.123.com 3. Timestamp ( start - end ) ex: 2008-05-04-00:30:00 - 2008-05-08-04:30:00 Can anyone help to devise a script for... (9 Replies)
Discussion started by: indiakingz
9 Replies

3. Shell Programming and Scripting

Script which will search for a file for 15 mins

Hi All, I would like to write a script which will search a file say abc.dat in /a/b/data for 15 mins only. If the script finds the file in 15 mins then it will exit will exit sucessfully and if there is no file for 15 mins it will exit and copy the last day file (abc.dat_ddmmyyhhmmss) from... (1 Reply)
Discussion started by: chandancsc
1 Replies

4. Shell Programming and Scripting

need a shell script to extract data from a log file.

If I have a log like : Mon Jul 19 05:07:34 2010; TCP; eth3; 52 bytes; from abc to def Mon Jul 19 05:07:35 2010; UDP; eth3; 46 bytes; from aaa to bbb Mon Jul 19 05:07:35 2010; TCP; eth3; 52 bytes; from def to ghi I will need an output like this : Time abc to def... (1 Reply)
Discussion started by: hitha87
1 Replies

5. Shell Programming and Scripting

Retrieve logs generated in last 10 mins from a log file using 'grep' command

HI All, I have a log file where the logs will be in the format as given below: 2011-05-25 02:32:51 INFO PROCESS STARTING 2011-05-25 02:32:52 INFO PROCESS STARTED . . . I want to retrieve only the logs which are less than 5 mins older than current time using grep... (3 Replies)
Discussion started by: rvhg16
3 Replies

6. AIX

Grep last 5 mins from log file in AIX

I want to grep only last 5 mins of a log file in bash I have a syslog which contains the following Mon Jul 11 20:47:42 Mon Jul 11 20:47:52 The following works in Unix but not in AIX . Please can you let me know as to what would be the AIX equivalent Code: for (( i = 5; i >=0;... (1 Reply)
Discussion started by: necro98
1 Replies

7. Shell Programming and Scripting

Averaging data every 30 mins using AWK

A happy Monday to you all, I have a .csv file which contains data taken every 5 seconds. I want to average these 5 second data points into 30 minute averages! date co2 25/06/2011 08:04 8.31 25/06/2011 08:04 8.32 25/06/2011 08:04 8.33... (18 Replies)
Discussion started by: gd9629
18 Replies

8. Shell Programming and Scripting

Script (ksh) to get data in every 30 mins interval for the given date

Hello, Since I m new to shell, I had a hard time to sought out this problem. I have a log file of a utility which tells that batch files are successful with timestamp. Given below is a part of the log file. 2013/03/07 00:13:50 Apache/1.3.29 (Unix) configured -- resuming normal operations... (12 Replies)
Discussion started by: rpm120
12 Replies

9. Shell Programming and Scripting

Script to search for a pattern in 30 minutes from a log file

Hello All, I have to write a script which will search for diffrent patterns like "Struck" "Out of Memory" , etc from a log file in Linux box's. Now I will be executing a cron job to find out the results by executing the script once in every 30 minutes. suppose time is 14-04-29:05:31:09 So I... (3 Replies)
Discussion started by: Shubhasis Mathr
3 Replies

10. Shell Programming and Scripting

Script to find directory is getting files in every 10 mins, if not then when last time file received

Dears, I am looking for a script which will work as a watch directory. I ha directory which keep getting files in every 10 mins and some time delay. I want to monitor if the directory getting the files in every 10 mins if not captured the last received file time and calculate the delay. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies
Sensor Classes(3)						       Coin							 Sensor Classes(3)

NAME
Sensor Classes - Classes class SoAlarmSensor The SoAlarmSensor class is a sensor which will trigger once at a specified time. SoAlarmSensor provides a convenient way of setting up triggers for jobs which should be executed only once when they are scheduled. " class SoDataSensor The SoDataSensor class is the abstract base class for sensors monitoring changes in a scene graph. If you need to know when a particular entity (as a field or a node) changes, subclasses of SoDataSensor can be used to monitor the entity and notify you when it changes. " class SoDelayQueueSensor The SoDelayQueueSensor class is the abstract base class for priority scheduled sensors. Delay queue sensors are invoked upon various events not related to time occurrences. See documentation of subclasses to see which types of events can be surveilled by the builtin sensor types. " class SoFieldSensor The SoFieldSensor class detects changes to a field. Attach a field to a sensor of this type to put it under surveillance, so you can act upon changes to the field. " class SoIdleSensor The SoIdleSensor class is a sensor which will trigger as soon as the application is idle. An SoIdleSensor differs from an SoOneShotSensor in that it will not trigger if the delay queue processing is occurring due to the delay queue timeout, but only when the application is idle. " class SoNodeSensor The SoNodeSensor class detects changes to nodes. Attach a node to a sensor of this type to put it under surveillance, so you can act upon changes to the node. " class SoOneShotSensor The SoOneShotSensor class is a sensor which will trigger once. Since SoOneShotSensor is a subclass of SoDelayQueueSensor, it will trigger as soon as either the run-time system is idle, or if it is continually busy it will trigger within a fixed amount of time (this is by default 1/12th of a second, see SoSensorManager::setDelaySensorTimeout()). " class SoPathSensor The SoPathSensor class detects changes to paths. If you need to know when a path changes (i.e. nodes in the path has been removed, or new nodes is added), use this sensor to get a notification. " class SoSensor The SoSensor class is the abstract base class for all sensors. Sensors is a mechanism in Coin for scheduling jobs to be run upon specific events. The events in question could be particular points in time, or changes to entities in the scene graph. " class SoSensorManager The SoSensorManager class handles the sensor queues. There are two major sensor types in Coin, 'delay' sensors and 'timer' sensors: " class SoTimerQueueSensor The SoTimerQueueSensor class is the abstract base class for sensors triggering on certain timer events. Timer sensors triggers upon specific points in time. " class SoTimerSensor The SoTimerSensor class is a sensor which will trigger at given intervals. Use sensors of this class when you want a job repeated at a certain interval, without explicitly needing to reschedule the sensor (i.e. SoTimerSensor automatically re-schedules itself after it has been triggered). " Detailed Description Sensors are objects that monitor other objects for changes and invoke callbacks when changes occur. Author Generated automatically by Doxygen for Coin from the source code. Version 3.1.3 Wed May 23 2012 Sensor Classes(3)
All times are GMT -4. The time now is 12:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy