Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AWSLOGS: Recreate CloudWatch Log Stream if it is deleted out from under us #52976

Description

@OYTAdmin

Description

I noticed that if I delete all of the log streams in my ECS service's log group, then ECS stops logging until I kill/restart the service. This is an unexpected behavior compared to other AWS services that will create a new log stream and continue logging when log streams are deleted.

I believe the solution is to catch the error when it happens, and if the error is ResourceNotFoundException on the log stream, then recreate the stream (or create a new one) and submit the batch again.

I think the relevant code is at

resp, err := l.client.PutLogEvents(context.TODO(), input)

This would be a nice quality of life improvement for those of us who are testing code running in ECS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shiny
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions