Click here to Skip to main content
15,120,739 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to read many log files stored across multiple servers as part of log monitoring. usually the process takes 30-60 seconds to finish a monitoring cycle time, but if there is any issue with particular server the server log file reading takes longer than expected.

I want my program to send an alert if a particular server log file is unreadable for certain time frame and process the next one.

What approach should I take? so that the following lines cab be skipped if it takes more than the specified intervall?

What I have tried:

with open(logServerFilename, 'r') as content_file:
Updated 7-Dec-18 4:16am

1 solution

You need a timer that will interrupt your code, or a separate thread that can signal you when a number of seconds have elapsed. See threading — Thread-based parallelism — Python 3.7.1 documentation[^] and threading — Timer[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900