Help needed on Perl Script to Handle Log files that are rotated using logrotate

Hello all,

I am working on a perl script which will read weblogic logfile and send the error messages to Zenoss Monitoring tool. At present the script works and it can able to send the error messages to Zenoss. The problem comes when the logrotate has been applied to the weblogic log file. At that time the script couln't able to read the log file since the logfile content has been shifted to log_file.1. Can you please help how can i handle this situation in Perl script.

Regards
Karthik

In general scripting pseudo-code, create a marker file with the last line # you examined in it immediately at the end of the scan. On the next pass, find files newer than the marker file and concatenate them to standard in, discarding the number of lines in the marker file. This way, the script only sees new lines from new files. If during the last scan there were logs log1 to log87 and log being written, and you saw 3214 lines of that file, later when you return there might be logs log1 to log99, but you want to start after line 3214 of log88 examining through log99 and then log.

Thanks DGPickett , As per your instruction i have created the script Can you please tell me how to test this scenario with out actual logrotation. As i dont have neccessary prvilages to do that . Moreover i am new to unix environment.

You can make a copy of the system logs in a space where you have space and write permissions, updating it periodicially using cpio or rsync, and test on that.