Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Software to monitor the logs dynamically Post 302843923 by blackrageous on Thursday 15th of August 2013 04:46:34 PM
Old 08-15-2013
You could of course do
Code:
 tail -f <file-in-question> | my.cheapscript.sh

and my.cheapscript.sh could continue to loop and process whatever...
Code:
#my.cheapscript.sh
while read a 
do
<<insert magic here>>
done

You'll have to make sure that you insure you are at the latest version of the file you are monitoring since even dynamic files have to be pruned. It depends on how the dynamic log file is being written to....does the process keep it open while it's logging...do an fuser <log-file> to see if there is a process pid associated with it. If so then in you cheap script you can save the pid (before the while loop).
If the file gets renamed or deleted you'll need to check for a new version of the file and the tail will break. You could do this all in a single script file and not have to tail to a script file...perhaps something like
Code:
#my.cheap.script.too.sh
FILE_TO_MONITOR="some-file.log"
while ((1)) 
do
tail -f ${FILE_TO_MONITOR} | while read a
do
<<magic>>
done

I am not 100 percent sure that's bullet proof but you get the idea.

Last edited by blackrageous; 08-15-2013 at 05:55 PM..
 

8 More Discussions You Might Find Interesting

1. Solaris

Logs Analysis Software ?

Hi, What is the best log analysis software for Solaris ?? Regards (3 Replies)
Discussion started by: adel8483
3 Replies

2. UNIX for Dummies Questions & Answers

how to view dynamically updated managed server logs from the same putty window

Hi, I want to know how we can view two or three logs which are dynamically getting updated from a single/same putty window with tail commnad. Thanks. (7 Replies)
Discussion started by: reachsudha
7 Replies

3. Shell Programming and Scripting

monitor new logs

I would like to monitor logfile for specific keyword and send email once detected. I'm trying out the code here, the script is scheduled to run every minute. Everytime it runs, the same log will be detected and send email. Anyway it can be improved to detect only new logs? tail -f /logfile |... (2 Replies)
Discussion started by: gklntn
2 Replies

4. Red Hat

Want to Monitor the Pidgin Logs

Hi Team, Am the Root user I want to monitor the user's chat actions. So How do I check the Remote system users Pidgin Chat logs history. And where the logs will be stored exactly?? Give me a solution!! (2 Replies)
Discussion started by: Adhi
2 Replies

5. Shell Programming and Scripting

Monitor logs for exception and if exception come then sent an email

Hi Folks, please advise , I have logs generated on unix machine at location /ops/opt/aaa/bvg.log , now sometimes there come exception in these logs also, so I want to write such a script such that it should continuously monitor these logs and whenever any exception comes that is it try to find... (3 Replies)
Discussion started by: tuntun27272727
3 Replies

6. Shell Programming and Scripting

[Help] Script to monitor logs

Hello friends, as they are? First of all sorry for my poor English. I tell them what is my problem. I have the following script, which is basically what makes error search for a pattern within a folder containing logs. The script works fine, the problem is that whenever I find a pattern of new... (2 Replies)
Discussion started by: romanrsr
2 Replies

7. Infrastructure Monitoring

Searching for Saas Monitor service which monitor my servers which are sitting in different providers

Sorry if this is the wrong forum Searching for Saas Monitor service which monitor my servers which are sitting in different providers . This monitor tool will take as less CPU as possible , and will send info about the server to main Dashboard. The info I need is CPU / RAM / my servers status (... (1 Reply)
Discussion started by: umen
1 Replies

8. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies
IO::Async::Signal(3pm)					User Contributed Perl Documentation				    IO::Async::Signal(3pm)

NAME
"IO::Async::Signal" - event callback on receipt of a POSIX signal SYNOPSIS
use IO::Async::Signal; use IO::Async::Loop; my $loop = IO::Async::Loop->new; my $signal = IO::Async::Signal->new( name => "HUP", on_receipt => sub { print "I caught SIGHUP "; }, ); $loop->add( $signal ); $loop->run; DESCRIPTION
This subclass of IO::Async::Notifier invokes its callback when a particular POSIX signal is received. Multiple objects can be added to a "Loop" that all watch for the same signal. The callback functions will all be invoked, in no particular order. EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters: on_receipt Invoked when the signal is received. PARAMETERS
The following named parameters may be passed to "new" or "configure": name => STRING The name of the signal to watch. This should be a bare name like "TERM". Can only be given at construction time. on_receipt => CODE CODE reference for the "on_receipt" event. Once constructed, the "Signal" will need to be added to the "Loop" before it will work. AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-10-24 IO::Async::Signal(3pm)
All times are GMT -4. The time now is 05:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy