Skip to content

Commit 9a13286

Browse files
committed
Add regex for timestamp mapping
1 parent fb91145 commit 9a13286

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

aiopslab/orchestrator/actions/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ def get_logs(namespace: str, service: str) -> str:
7070
except Exception as e:
7171
return "Error: Your service/namespace does not exist. Use kubectl to check."
7272

73-
print(logs)
7473
logs = "\n".join(logs.split("\n"))
7574
logs = greedy_compress_lines(logs)
75+
print(logs)
7676
return logs
7777

7878
@staticmethod

aiopslab/orchestrator/actions/log_deduplication.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,21 @@
1212
# -------------------------------
1313
DEFAULT_TIMESTAMP_REGEX = (
1414
r"(?:"
15-
r"\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}:\d{2}(?:Z|[+-]\d{2}:\d{2})?)"
15+
# ISO-like: 2025-09-24 18:41:09 or 2025-09-24T18:41:09Z
16+
r"\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)"
1617
r"|"
18+
# Abbreviated month: 2025-Sep-24 18:41:09.830218
19+
r"\d{4}-[A-Z][a-z]{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)?"
20+
r"|"
21+
# Time only: 18:41:09
1722
r"\b\d{2}:\d{2}:\d{2}\b"
1823
r"|"
24+
# Durations: 10m5s, 30s
1925
r"\b\d+m(?:\d+s)?\b"
2026
r"|"
2127
r"\b\d+s\b"
2228
r"|"
23-
r"\[\d{4}-[A-Z][a-z]{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+\]"
24-
r"|"
29+
# syslog-like: Wed Sep 24 18:41:09 2025
2530
r"[A-Z][a-z]{2} [A-Z][a-z]{2} \d{2} \d{2}:\d{2}:\d{2} \d{4}"
2631
r")"
2732
)

0 commit comments

Comments
 (0)