Skip to content

Commit 0e5f47f

Browse files
committed
Fixing issue when log stream name mismatch
1 parent 26d6047 commit 0e5f47f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tail-task-logs.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
last_event = None
1414
log_group_name='/ecs/'+cluster_name+'/'+app_name
1515

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

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

5959
time.sleep(1)
6060

61+
except logs.exceptions.ResourceNotFoundException as e:
62+
time.sleep(5)
63+
continue
64+
6165
except Exception as e:
6266
print("Error: " + str(e))
6367
break

0 commit comments

Comments
 (0)