Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script to search log file for last 15 mins data Post 302956113 by mutley2202 on Saturday 26th of September 2015 07:54:23 AM
Old 09-26-2015
Script to search log file for last 15 mins data

Hi All,
I have an issue which I'm trying to understand a way of doing, I have several nodes which contain syslog events which I want to force trigger an email initially (eventually leading to another method of alerting but to start with an email).

Basically the syslog file will have hours worth of data in however I want to run a script every 15 minutes that searches the file but only for the last 15 minutes worth of data. The data in the file will appear like the below however note that other lines of data will be in the file and also their will be variable information after the semi-colon on each lines.

Code:
 Sat Sep 26 12:05:41 2015 Internal trap notification 1167 (MMES1AssocFail) MME S1 Association failed;
Sat Sep 26 12:07:50 2015 Internal trap notification 1168 (MMES1AssocEstab) MME S1 Association established;
Sat Sep 26 12:07:50 2015 Internal trap notification 1190 (MMES1PathEstab) MME S1 path established;
Sat Sep 26 12:26:55 2015 Internal trap notification 1189 (MMES1PathFail) MME S1 path failed;
Sat Sep 26 12:26:55 2015 Internal trap notification 1167 (MMES1AssocFail) MME S1 Association failed;
Sat Sep 26 12:27:04 2015 Internal trap notification 1168 (MMES1AssocEstab) MME S1 Association established;
Sat Sep 26 12:27:04 2015 Internal trap notification 1190 (MMES1PathEstab) MME S1 path established;
Sat Sep 26 12:27:26 2015 Internal trap notification 1189 (MMES1PathFail) MME S1 path failed;
Sat Sep 26 12:27:26 2015 Internal trap notification 1167 (MMES1AssocFail) MME S1 Association failed;

Does anyone have any examples where it would only look at the previous 15 mins based on the date and timestamp on each line ?

Thanks in advance.
 

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
trigger(8)						      System Manager's Manual							trigger(8)

Name
       trigger - trigger a target node to request a down-line load

Syntax
       /etc/trigger node [ options ]

Description
       The command triggers the bootstrap mechanism of a target node, causing the target to request a down-line load.  Once a target node is trig-
       gered, it loads itself in whatever manner its primary loader is programmed to operate.  The target node could request a down-line load from
       the host that just triggered it or from another adjacent node, or the target node could load itself from its own mass storage device.

       The  node argument is the name or address of the target node.  A node name consists of from one to six alphanumeric characters.	For single
       networks, a node address consists of a decimal integer (1-1023).  For multiple networks, a node address consist	of  two  decimal  integers
       (n.n), where the first indicates the network number (1-63), and the second indicates the node address (1-1023).

       The  command requires the identification of the service circuit over which the load is performed, the Ethernet hardware address of the tar-
       get node, and the service password needed to gain access to the target.	This information is included in the nodes database entry  for  the
       target node.  A node entry is defined with the command.	For further information, see Alternatively, you can choose not to include a target
       node's service password in the nodes database for security reasons.  You must therefore specify this value in the command line by using the
       -p option.

Options
       -p     Uses the specified service and password (next arguments) in accessing the target node.

Examples
       This command triggers node Bangor to issue a down-line load request:
       # /etc/trigger bangor <RET>

See Also
       mop_mom(8), addnode(8), load(8), remnode(8), getnode(8), ccr(8)
       Guide to Local Area Transport Servers

																	trigger(8)
All times are GMT -4. The time now is 03:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy