Skip to content

Commit

Permalink
Fixing issue when log stream name mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
adenot committed May 13, 2020
1 parent 26d6047 commit 0e5f47f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tail-task-logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
last_event = None
log_group_name='/ecs/'+cluster_name+'/'+app_name

log_streams = logs.describe_log_streams(logGroupName=log_group_name, orderBy='LastEventTime', limit=1)
log_streams = logs.describe_log_streams(logGroupName=log_group_name, orderBy='LastEventTime', descending=True, limit=1)

if len(log_streams['logStreams']) == 0:
print("No log streams found for log group %s" % log_group_name)
Expand Down Expand Up @@ -58,6 +58,10 @@

time.sleep(1)

except logs.exceptions.ResourceNotFoundException as e:
time.sleep(5)
continue

except Exception as e:
print("Error: " + str(e))
break
Expand Down

0 comments on commit 0e5f47f

Please sign in to comment.