Sponsored Content
Operating Systems AIX Grep last 5 mins from log file in AIX Post 302537950 by necro98 on Monday 11th of July 2011 07:00:21 AM
Old 07-11-2011
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:
Code:
for (( i = 5; i >=0; i-- )) ; do      grep $(date +%R -d "-$i  min") syslog >> newfile done

Moderator's Comments:
Mod Comment Link to new thread: Grep last 5 mins from log file in AIX

Last edited by Scott; 07-11-2011 at 09:13 AM.. Reason: Add link to post
 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

file old than 10 mins to alert

Hello We have to monitor a FTP utility where we have to monitor for checking presence of a file in directory With max time allowed for a file to stay in the directory on FTP client server as 10 mins. The only way we are going to be able to do what we are lookign for is to write a script to... (1 Reply)
Discussion started by: vivkas
1 Replies

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

4. Shell Programming and Scripting

Shell Script to grep Job File name and Log File name from crontab -l

Hello, I am new to shell scripting. I need to write a shell script where i can grep the name of file ie. .sh file and log file from crontab -l. #51 18 * * * /home/oracle/refresh/refresh_ug634.sh > /home/oracle/refresh/refresh_ug634.sh.log 2>&1 #40 17 * * * /home/oracle/refresh/refresh_ux634.sh... (1 Reply)
Discussion started by: guptra
1 Replies

5. UNIX for Dummies Questions & Answers

[Solved] Check for a file and keep waiting for 30 mins

Hi All! I want to have a shell script that checks for a file in a particular folder and then if the file is not found it should wait for 30 minutes. Again check for the file, if it FOUND then successfuly exit the shell script stating the file is found. Else it should continue to wait. ... (4 Replies)
Discussion started by: akshay01987
4 Replies

6. Shell Programming and Scripting

How to grep a log file for words listed in separate text file?

Hello, I want to grep a log ("server.log") for words in a separate file ("white-list.txt") and generate a separate log file containing each line that uses a word from the "white-list.txt" file. Putting that in bullet points: Search through "server.log" for lines that contain any word... (15 Replies)
Discussion started by: nbsparks
15 Replies

7. Shell Programming and Scripting

How to check if there is a file in the last 10 mins?

I have a script that runs every hour from the crontab (see the settings of the crontab below) (15 mins past the hour) 15 * * * * /home/usr/usr1/ProvAll This script saves two files in the following format now=`/bin/date '+%Y%m%d.%H%M%S'` file1.$now (for example) file1.20140722.031502... (12 Replies)
Discussion started by: knijjar
12 Replies

8. UNIX for Dummies Questions & Answers

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

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

10. UNIX for Beginners Questions & Answers

Grep last 5 mins from logs

Hi, system date format Thu Jun 13 12:55:18 EDT 2019 My log date format 09.148.192.60 - - "GET /akamai/sureroute-test-object.html HTTP/1.1" 404 231 can someone please help me, how to get last 5mins of logs please ? I need the command Please wrap your samples/codes in CODE TAGS,... (3 Replies)
Discussion started by: scazed
3 Replies
DPM-RFIOD(8)						    Rfio Administrator Commands 					      DPM-RFIOD(8)

NAME
dpm-rfiod- Remote file access daemon SYNOPSIS
dpm-rfiod [ -d ] [ -f filename ] [ -l ] [ -p port ] [ -s ] [ -t ] [ -4 | -6 ] [ -L log_level ] DESCRIPTION
dpm-rfiod start the daemon handling remote file access requests. This command is usually executed at system startup time (/etc/rc.local). dpm-rfiod uses for the streaming mode (v3) one control port and one data port. The range of data ports to be used by dpm-rfiod can be set with the environment variable RFIO_PORT_RANGE. OPTIONS
-d Turn on printing of debug messages. Default output device is stderr. -f filename Output filename for error, logging and debugging messages. Normal error messages are sent to syslog unless otherwise specified. Two filenames are special : "stderr", which will send messages to standard error and "syslog" which will send to syslog. -l Turn on printing of log messages. Default output device is in /var/log/rfio/log. -p port Specify a network port for the service to listen on. If this option is not given the value RFIO_PORT defined in rfio_constants.h is used. -s Turn on Standalone mode. This option should always be set when dpm-rfiod is not started by inetd. -t Turn on single threaded mode. Useful for debugging as no processes are created. -4 only try to listen on IPv4 addresses -6 only try to listen on IPv6 addresses -L log_level Specify the logging level. Default 6 (LOG_INFO). EXAMPLE
/usr/sbin/dpm-rfiod -sl SEE ALSO
syslog(8), tcp(4) AUTHOR
LCG Grid Deployment Team LCG
$Date: 2010-08-30 08:39:36 +0200 (Mon, 30 Aug 2010) $ DPM-RFIOD(8)
All times are GMT -4. The time now is 09:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy