Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions iShutdown_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import re
import tarfile
from datetime import datetime
from datetime import datetime, timezone
from termcolor import colored


Expand All @@ -31,7 +31,7 @@ def find_anomalies_before_sigterm(content, anomaly_phrase, threshold=3):
elif sigterm_match := sigterm_pattern.search(line):
if anomaly_count >= threshold:
unix_timestamp = int(sigterm_match.group(1))
anomalies_timestamps.append(datetime.utcfromtimestamp(unix_timestamp))
anomalies_timestamps.append(datetime.fromtimestamp(unix_timestamp, timezone.utc))
anomaly_count = 0

return anomalies_timestamps
Expand All @@ -54,7 +54,7 @@ def process_hits(content, hit_phrase):
match = sigterm_pattern.search(line)
if match:
unix_timestamp = int(match.group(1))
date = datetime.utcfromtimestamp(unix_timestamp)
date = datetime.fromtimestamp(unix_timestamp, timezone.utc)
if found_hit:
decoded_dates.append(date.strftime('%Y-%m-%d %H:%M:%S UTC'))
found_hit = False
Expand Down