Log Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Log Script
# 1  
Old 05-22-2009
Log Script

Can we write any command/Script....to find out the data in a log file for last 5 mins?
# 2  
Old 05-23-2009
thats possible in two ways..
1)if your log file has any timestam inside
i mean every line start with a time stamp
like 11:21:32 something...
etc.
2)you run a script every 5 min create a copy of that log file
and after 5 min compare old copy with new and print the difference
# 3  
Old 05-23-2009
How does the log file get written? Does it write contineously or at some intervals?

If they are written at some intervals, then you might want to strat another process to get the logs at the same interval using
Code:
tail -f logfile >> partlog

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script newbie- how to generate service log from shell script

Hi, I am totally a newbie to any programming languages and I just started an entry level job in an IT company. One of my recent tasks is to create a script that is able to show the log file of linux service (i.e. ntpd service) lets say, if I run my script ./test.sh, the output should be... (3 Replies)
Discussion started by: xiaogeji
3 Replies

2. Shell Programming and Scripting

Shell Script function to use script name for log file output

Hi Team - I"m very new to Shell Scripting so I have a rather novice question. My forte is Windows Batch Scripting so I was just wondering what the Shell Script equivalent is to the DOS command %~n? %~n is a DOS variable that dispayed the script name. For instance (in DOS): REM... (11 Replies)
Discussion started by: SIMMS7400
11 Replies

3. Shell Programming and Scripting

Script to read a log file and run 2nd script if the dates match

# cat /tmp/checkdate.log SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 17 22:49:00 2012 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production FIRST_TIME NEXT_TIME... (1 Reply)
Discussion started by: SarwalR
1 Replies

4. Shell Programming and Scripting

Help with a rotate log script

Hi all, Am trying to write my own log rotate script. Curremtly, what I have is as below: #!/bin/ksh file_to_rotate=${1} x=${2} while ] do let curr=${x} let prev=${x}-1 if ] ; then #echo "cp -p ${file_to_rotate} ${file_to_rotate}.${curr}" cp -p... (7 Replies)
Discussion started by: newbie_01
7 Replies

5. HP-UX

Script to monitor /var/opt/resmon/log/event.log file

AM in need of some plugin/script that can monitor HP-UX file "/var/opt/resmon/log/event.log" . Have written a scrip in sh shell that is working fine for syslog.log and mail.log as having standard format, have interrogated that to Nagios and is working as I required . But same script failed to... (3 Replies)
Discussion started by: Shirishlnx
3 Replies

6. Shell Programming and Scripting

Log Script

Hello, I am running running a file that I created to tail our log, stripping out some key words to avoid noise. I want to script this vs using something bellow, something simple were I could populater a txt file and it would filter content from that text file my other idea was to add a section... (5 Replies)
Discussion started by: NelsonC
5 Replies

7. Shell Programming and Scripting

log file script

I have a log which is configured as follows: date time code1 notes: code2 A monthly job is run based on information supplied from this log. The end of each monthly job is clearly indicated by a code within 'code1'. At this time someone is performing a less on the log, moving to the end,... (2 Replies)
Discussion started by: bwatlington
2 Replies

8. Shell Programming and Scripting

Script for Log Rotate

Hello, I only know the basic for shell programing. I need help for this, I thinks this is a basic for anyone who know a litle of shell scripting. I need creat a script for a rotatate logs, when a filesystem is full. I have a filesystem. The rotate consist in zip the current log (copy) and... (1 Reply)
Discussion started by: El Rengo
1 Replies

9. Shell Programming and Scripting

Log Search Script

Hi, I am trying to write a script to search a log- IPaddress being the search criteria, I would ideally like the script to ask the ipaddress Enter IP address - 244.258.27.225 And the ideal result would be for the script to get all the entries in the log file for a particular IP address,... (3 Replies)
Discussion started by: fuzion.hyd
3 Replies

10. Shell Programming and Scripting

log in as su from a script

Hi, I am running a script where i need to run another command in a particular folder which I do not have access so I need to login as su to that folder and run that script...what are the options I need so that I can skip interactive mode ..here is what I tried.. #! /usr/bin/sh... (1 Reply)
Discussion started by: mgirinath
1 Replies
Login or Register to Ask a Question