Skip to content

Commit 0917323

Browse files
committed
When no audit log is available an IndexError is thrown which is not clear
for all users. This minor change will log a critical error with an explanation why it errors out.
1 parent 9b65b4a commit 0917323

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/SimpleReplay/extract.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import logging
66
import os
77
import re
8+
import sys
9+
810
import redshift_connector
911
import threading
1012
import time
@@ -850,9 +852,15 @@ def get_s3_audit_logs(
850852
else:
851853
curr_index -= 1
852854

853-
logger.debug(
854-
f'First audit log in start_time range: {audit_objects[curr_index]["Key"].split("/")[-1]}'
855-
)
855+
try:
856+
logger.debug(
857+
f'First audit log in start_time range: {audit_objects[curr_index]["Key"].split("/")[-1]}'
858+
)
859+
except IndexError:
860+
logger.fatal(f"There was no user activity log available yet.")
861+
logger.fatal("Make sure audit logging and user activity logging are enabled and await shipment of the logs.")
862+
sys.exit(1)
863+
856864
return (connections, logs, databases, last_connections)
857865

858866

0 commit comments

Comments
 (0)