Skip to content

Commit

Permalink
When no audit log is available an IndexError is thrown which is not c…
Browse files Browse the repository at this point in the history
…lear

for all users. This minor change will raise a runtime error stating that
not a single audit log was available in the given time range.
  • Loading branch information
pvbouwel committed Sep 8, 2021
1 parent 9b65b4a commit 6192e85
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/SimpleReplay/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,12 @@ def get_s3_audit_logs(
else:
curr_index -= 1

logger.debug(
f'First audit log in start_time range: {audit_objects[curr_index]["Key"].split("/")[-1]}'
)
try:
logger.debug(
f'First audit log in start_time range: {audit_objects[curr_index]["Key"].split("/")[-1]}'
)
except IndexError as e:
raise RuntimeError(f"There wasn't a single audit log for the time range {start_time} - {end_time}") from e
return (connections, logs, databases, last_connections)


Expand Down

0 comments on commit 6192e85

Please sign in to comment.