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

NAME
ap-trapd - a SNMP trap processing daemon SYNOPSIS
ap-trapd [ -i device ] [-u user ] [-s] DESCRIPTION
ap-trapd It's a SNMP trap processing daemon that accepts traps, parse them and store useful data using syslog, at logging LEVEL0. Specify device to listen for SNMP traps on the particular device (this option only works at Linux). To be running by user different from nobody you may specify user. To correct work with Smartbridges APs specify -s key (they use specific traps). Utility added to ap-utils from version 0.8. SYSLOG
To store traps to own log file you may add next string to your /etc/syslog.conf local0.* /var/log/ap-traps.log After doing it, just restart syslogd with command like killall -HUP syslogd TRAPS
When a trap is received, a message will be logged indicating that an action happened to the Access Point such as: Trap Reassociation: This trap message is sent when a Station reassociation request is received from Access Point. Trap Association: Indicates the reception of an association request packet and the sender Station's successful association with the Access Point. Trap Disassociation: This trap message is sent when a disassociation notification packet is received from a Station. Trap Reset: This trap message is sent when Access Point Resets. Trap Setting IP Address with Ping: This trap message is sent when the Access Point IP address is set with the transmission of a ping message. Trap Start Up: This trap message is sent when the Access Point Starts Up. Trap Failed To Erase Flash: This trap message is sent when Access Point Failed To Erase Flash. APClientScanning Access Point Client is scanning... APClientAuthenticating Access Point Client is authenticating with the AP. APClientAssociating Access Point Client is associating with the AP. APClientReAssociating Access Point Client is reassociating with the AP. APClientAuthenticationFailed Access Point Client has failed authenticating with the AP. APClientAssociationFailed Access Point Client has failed associating with the AP. APClientConnected Access Point Client has been connected with the AP. APClientDisconnected Access Point Client has been disconnected from the AP. APClientScanFailed Access Point Client has failed scanning! APClientJoinFailed Access Point Client has failed joining! APClientJoining Access Point Client is in join state. Smartbridges specific TRAPS MultiAttachedStation Multiple attached stations in the ethernet size SECURITY Utility ap-trapd must be running by 'root', after opening port utility change owner to 'nobody', so this user must exist in you sys- tem. You may set user using -u option as described below for change default unprivileged user. AUTHOR
Roman Festchook <roma@polesye.net> http://ap-utils.polesye.net SEE ALSO
ap-config(8), ap-mrtg(8), syslogd(8) Wireless Access Point Utilities for Unix ap-trapd(8)
All times are GMT -4. The time now is 08:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy