Closed sean-kuendig-copebit closed 9 months ago
The default is indefinite retentions so it looks like this is just not being changed when you are trying to set it to 30. Looking into this.
Sorry for the delay. I was able to reproduce this and it seems to be that the problem is with the service not this sdk. The response for logGroupNamePattern
is missing the retentionInDays
logGroupNamePrefix:
{"logGroups":[{"arn":"arn:aws:logs:us-west-2:xxxxxxxxxx:log-group:mfb2sj:*","creationTime":1696373299319,"logGroupName":"mfb2sj","metricFilterCount":0,"retentionInDays":30,"storedBytes":0}]}
logGroupNamePattern:
{"logGroups":[{"arn":"arn:aws:logs:us-west-2:xxxxxxxxxx:log-group:mfb2sj:*","creationTime":1696373299319,"logGroupName":"mfb2sj","metricFilterCount":0}],"nextToken":"nexttokenstring"}
Opening internal request to service team
P101732296
This behaving as expected. As noted in the docs here:
If you specify logGroupNamePattern in your request, then only arn, creationTime, and logGroupName are included in the response.
So with logGroupNamePattern you can't get the RetentionInDays. Please let me know if you have any other questions
This issue is now closed.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
The CloudWatchLogs client provides two options for retrieving a log group by its name:
LogGroupNamePattern
andLogGroupNamePrefix
. When using theLogGroupNamePrefix
parameter, theRetentionInDays
field of the log group is set. However, if you use theLogGroupNamePattern
parameter instead, theRetentionInDays
field is not set.Expected Behavior
The field RetentionInDays should be consistently set, regardless if the log group is being described by its name with the parameter
LogGroupNamePattern
orLogGroupNamePrefix
.Current Behavior
Only the log group that is described via
LogGroupNamePrefix
has the RetentionInDays set. If the log group is described by usingLogGroupNamePattern
the RetentionInDays is nil.The output below happens when the code in the reproduction steps is run:
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/smithy-go@v1.13.5 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/google/go-cmp@v0.5.8 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/jmespath/go-jmespath@v0.4.0 github.com/aws/aws-sdk-go-v2/config@v1.18.21 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/config@v1.18.21 github.com/aws/aws-sdk-go-v2/credentials@v1.13.20 github.com/aws/aws-sdk-go-v2/config@v1.18.21 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.13.2 github.com/aws/aws-sdk-go-v2/config@v1.18.21 github.com/aws/aws-sdk-go-v2/internal/ini@v1.3.33 github.com/aws/aws-sdk-go-v2/config@v1.18.21 github.com/aws/aws-sdk-go-v2/service/sso@v1.12.8 github.com/aws/aws-sdk-go-v2/config@v1.18.21 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.14.8 github.com/aws/aws-sdk-go-v2/config@v1.18.21 github.com/aws/aws-sdk-go-v2/service/sts@v1.18.9 github.com/aws/aws-sdk-go-v2/config@v1.18.21 github.com/aws/smithy-go@v1.13.5 github.com/aws/aws-sdk-go-v2/config@v1.18.21 github.com/google/go-cmp@v0.5.8 github.com/aws/aws-sdk-go-v2/credentials@v1.13.20 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/credentials@v1.13.20 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.13.2 github.com/aws/aws-sdk-go-v2/credentials@v1.13.20 github.com/aws/aws-sdk-go-v2/service/sso@v1.12.8 github.com/aws/aws-sdk-go-v2/credentials@v1.13.20 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.14.8 github.com/aws/aws-sdk-go-v2/credentials@v1.13.20 github.com/aws/aws-sdk-go-v2/service/sts@v1.18.9 github.com/aws/aws-sdk-go-v2/credentials@v1.13.20 github.com/aws/smithy-go@v1.13.5 github.com/aws/aws-sdk-go-v2/credentials@v1.13.20 github.com/google/go-cmp@v0.5.8 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.13.2 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.13.2 github.com/aws/smithy-go@v1.13.5 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.13.2 github.com/google/go-cmp@v0.5.8 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.1.32 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.4.26 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.4.26 github.com/aws/smithy-go@v1.13.5 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.4.26 github.com/google/go-cmp@v0.5.8 github.com/aws/aws-sdk-go-v2/internal/ini@v1.3.33 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs@v1.20.9 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs@v1.20.9 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.1.32 github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs@v1.20.9 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.4.26 github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs@v1.20.9 github.com/aws/smithy-go@v1.13.5 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.9.26 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.9.26 github.com/aws/smithy-go@v1.13.5 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.9.26 github.com/google/go-cmp@v0.5.8 github.com/aws/aws-sdk-go-v2/service/sso@v1.12.8 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/service/sso@v1.12.8 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.1.32 github.com/aws/aws-sdk-go-v2/service/sso@v1.12.8 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.4.26 github.com/aws/aws-sdk-go-v2/service/sso@v1.12.8 github.com/aws/smithy-go@v1.13.5 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.14.8 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.14.8 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.1.32 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.14.8 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.4.26 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.14.8 github.com/aws/smithy-go@v1.13.5 github.com/aws/aws-sdk-go-v2/service/sts@v1.18.9 github.com/aws/aws-sdk-go-v2@v1.17.8 github.com/aws/aws-sdk-go-v2/service/sts@v1.18.9 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.1.32 github.com/aws/aws-sdk-go-v2/service/sts@v1.18.9 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.4.26 github.com/aws/aws-sdk-go-v2/service/sts@v1.18.9 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.9.26 github.com/aws/aws-sdk-go-v2/service/sts@v1.18.9 github.com/aws/smithy-go@v1.13.5 github.com/aws/smithy-go@v1.13.5 github.com/google/go-cmp@v0.5.8 github.com/aws/smithy-go@v1.13.5 github.com/jmespath/go-jmespath@v0.4.0
Compiler and Version used
go version go1.19.3 darwin/amd64
Operating System and version
MacOs Ventura 13.0.1