Click here to Skip to main content
13,869,102 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190214.1 | Last Updated 7 Dec 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100