Skip to content

Commit a7aa40d

Browse files
committed
Log if data checks failed
1 parent adf12d2 commit a7aa40d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

roles/rsyslog/templates/parse_stepupauth_to_mysql.py.j2

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,21 @@ def parse_stepup_lines(a):
103103

104104
# Basic data validation
105105
if not user_id or not timestamp:
106+
print(
107+
"Skipping line: validation failed "
108+
f"(user_id={user_id!r}, timestamp={timestamp!r}, request_id={request_id!r})"
109+
)
106110
continue
107111

108112
try:
109113
# 3. Format date and time for MySQL
110114
loginstamp = parse(timestamp).strftime("%Y-%m-%d %H:%M:%S")
111115
last_login_date = parse(timestamp).strftime("%Y-%m-%d")
112116
except:
117+
print(
118+
"Skipping line: timestamp parsing failed "
119+
f"(timestamp={timestamp!r}, user_id={user_id!r}, error={e})"
120+
)
113121
continue
114122

115123
# 4. Insert into MySQL

0 commit comments

Comments
 (0)