Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitoring a log file which changes its name hourly

Status
Not open for further replies.

hlavender

IS-IT--Management
Joined
Apr 26, 2004
Messages
2
Location
US
Okay. team, I need your assistance.

I have to monitor a log file on a server. The log file name is XXX.HH - where HH is the current hour in 24 hour format. So, at the start of the night, the log file is named XXX.00, and between 1 am and 1:59:59 it is XXX.01, and so forth.
What I need to do is to read this file and send alerts if a regular expression is found. Any idea how to do this. I am stumped.

This must be easy but...
 
have you tried anything? Do you liteally mean you want to find a perl regular expression in the file?

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Sorry. No.. I was simply having problems figuring out how to switch to the next file at the top of the hour. My problem was I was (stupidly) using "tail" to read from the file. I modifed the program to read a line at a time and it appears to work.

Sorry to bother "the board".
 
So your problem now is just identifying which log file to use?

Code:
$latest_log_file = "XXX.".substr(localtime(),11,2);


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top