CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Monitor Growing log Files for Exceptions



Jan 23, 2009, 4:55 AM

Post #1 of 2 (889 views)
Monitor Growing log Files for Exceptions Can't Post

Hi All,

I am writing a code to monitor running processes and their log files. Suppose I have two Processes: Process_1 and Process_2, logs are Log_1 and Log_2. Everyday process, run it write to same log file. I want to run the program in loop. First run it should point to end of current log. It will finish its first run after looking for Log_1 and Log_2. In next run it (say sleeping for 5 mins) shoud only read the newly added lines in log Log_1 , Log_2 and check for exceptions. It should not read the log file from beginning during each cycle. I am trying something as below:

for (;;) {
for ($curpos = tell(FILE); $_ = <FILE>; $curpos = tell(FILE)) {
# search for some stuff and put it into files
seek(FILE, $curpos, 0);

But it is not working. I am new to perl so not able to find much.

Please assist.

Veteran / Moderator

Jan 23, 2009, 5:36 AM

Post #2 of 2 (885 views)
Re: [smart_amorist] Monitor Growing log Files for Exceptions [In reply to] Can't Post




Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives