diff --git a/get_page_stats.py b/get_page_stats.py index 0054a5c..26b3ae5 100755 --- a/get_page_stats.py +++ b/get_page_stats.py @@ -164,7 +164,9 @@ def parse_logfile(logfile_path: str, locations: List[str], visit_dict: VisitDict = dict(map(lambda x: (x, set()), locations)) bot_visit_dict: VisitDict = dict(map(lambda x: (x, set()), locations)) other_visit_dict: VisitDict = defaultdict(set) - + if abs(os.path.getmtime(logfile_path) - datetime.now().timestamp()) >= 24 * 3600: + print("Log file is too old, there was no access today.") + logfile_path="/dev/null" with open(logfile_path, 'r', encoding='utf-8') as logfile: for line in logfile: match_obj = re.match(known_page_regex, line)