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
Locale::Codes::Script(3pm)				 Perl Programmers Reference Guide				Locale::Codes::Script(3pm)

NAME
Locale::Codes::Script - standard codes for script identification SYNOPSIS
use Locale::Codes::Script; $script = code2script('phnx'); # 'Phoenician' $code = script2code('Phoenician'); # 'Phnx' $code = script2code('Phoenician', LOCALE_CODE_NUMERIC); # 115 @codes = all_script_codes(); @scripts = all_script_names(); DESCRIPTION
The "Locale::Codes::Script" module provides access to standards codes used for identifying scripts, such as those defined in ISO 15924. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 15924 four-letter codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying scripts. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $script = code2script('phnx','alpha'); $script = code2script('phnx',LOCALE_SCRIPT_ALPHA); The codesets currently supported are: alpha, LOCALE_SCRIPT_ALPHA This is a set of four-letter (capitalized) codes from ISO 15924 such as 'Phnx' for Phoenician. It also includes additions to this set included in the IANA language registry. The Zxxx, Zyyy, and Zzzz codes are not used. This is the default code set. num, LOCALE_SCRIPT_NUMERIC This is a set of three-digit numeric codes from ISO 15924 such as 115 for Phoenician. ROUTINES
code2script ( CODE [,CODESET] ) script2code ( NAME [,CODESET] ) script_code2code ( CODE ,CODESET ,CODESET2 ) all_script_codes ( [CODESET] ) all_script_names ( [CODESET] ) Locale::Codes::Script::rename_script ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::Script::add_script ( CODE ,NAME [,CODESET] ) Locale::Codes::Script::delete_script ( CODE [,CODESET] ) Locale::Codes::Script::add_script_alias ( NAME ,NEW_NAME ) Locale::Codes::Script::delete_script_alias ( NAME ) Locale::Codes::Script::rename_script_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::Script::add_script_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::Script::delete_script_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.unicode.org/iso15924/ Home page for ISO 15924. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 1997-2001 Canon Research Centre Europe (CRE). Copyright (c) 2001-2010 Neil Bowers Copyright (c) 2010-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-11-04 Locale::Codes::Script(3pm)
All times are GMT -4. The time now is 09:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy