Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudWatch Log Retention Period #650

Closed
stack72 opened this issue Apr 22, 2016 · 14 comments
Closed

CloudWatch Log Retention Period #650

stack72 opened this issue Apr 22, 2016 · 14 comments
Assignees
Labels
guidance Question that needs advice or information. service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@stack72
Copy link

stack72 commented Apr 22, 2016

Hi

When using the following code:

_, err := conn.CreateLogGroup(&cloudwatchlogs.CreateLogGroupInput{
    LogGroupName: aws.String("test),
})
if err != nil {
    return fmt.Errorf("Creating CloudWatch Log Group failed: %s", err)
}

putInput := cloudwatchlogs.PutRetentionPolicyInput{
    LogGroupName:    aws.String("test"),
    RetentionInDays: aws.Int64(7),
}
log.Printf("[DEBUG] Setting retention for CloudWatch Log Group: %q: %s", name, putInput)
_, err = conn.PutRetentionPolicy(&putInput)


input := &cloudwatchlogs.DescribeLogGroupsInput{
        LogGroupNamePrefix: aws.String("test""),
    }
resp, err := conn.DescribeLogGroups(input)
if err != nil {
    return nil, err
}

The response from the DescribeLogGroups doesn't give me the correct value (of 7) for the retention period. I need to call the Describe func a second time to get that value. It obviously takes some time for the retention period to be added to the LogGroup, but PutRetentionPolicy doesn't return me anything that allows me to wait for the state to be updated

Any suggestions here?

Paul

@xibz
Copy link
Contributor

xibz commented Apr 22, 2016

Hello @stack72, thank you for reaching out to us. It would seem if the request succeeds, then could you not wait the specified time? Let me know what concerns you have with this idea

@xibz xibz added the guidance Question that needs advice or information. label Apr 22, 2016
@xibz xibz self-assigned this Apr 22, 2016
@stack72
Copy link
Author

stack72 commented Apr 22, 2016

Hi @xibz

My apologies I wasn;t clear here. I mean that when i query the DescribeLogGroups that the value of 7 is not returned for RetentionInDays. that value of 7 is only available after a short (indeterminate) amount of time. My thought here is that the LogGroup takes some time for the change to be applied. But how can i know when the LogGroup has been updated?

P.

@xibz
Copy link
Contributor

xibz commented Apr 22, 2016

@stack72, what is it that you are trying to do with the RetentionInDays? I imagine you are looking to check the state of the LogGroup, like PENDING, that way you don't have to keep track of all the numbers. Let me know if this isn't the reasoning!

@stack72
Copy link
Author

stack72 commented Apr 22, 2016

@xibz

Thanks for the repo here. I will just check the state of the LogGroup to make sure that it isn't in a pending state. If it doesn't help then I will re-comment

Thanks

Paul

@xibz
Copy link
Contributor

xibz commented Apr 22, 2016

@stack72 - Unfortunately, there is no state associated with the LogGroups. I was curious if that was more of what you were trying to do. Sorry if I wasn't clear

@stack72
Copy link
Author

stack72 commented Apr 22, 2016

yeah that was what i was trying to achieve. How do I know when a retention period has been added to the LogGroup? It's not an immediate thing

@xibz
Copy link
Contributor

xibz commented Apr 22, 2016

Okay, I am asking Cloudwatch if there is a way to do this. It seems the SDKs do not allow for this. So, once they get back to me, I'll update you!

@stack72
Copy link
Author

stack72 commented Apr 22, 2016

thanks so much for all the help here @xibz :)

@jasdel jasdel added the service-api This issue is due to a problem in a service API, not the SDK implementation. label Apr 22, 2016
@stack72
Copy link
Author

stack72 commented Apr 27, 2016

Hi, any thoughts on the issue here?

thanks

Paul

@jasdel
Copy link
Contributor

jasdel commented Apr 27, 2016

Hi @stack72 we are working with the CloudWatch Logs team to get a better understanding of what the expected functionality of this issue is. We'll update this issue once we have more information from the service team.

@stack72
Copy link
Author

stack72 commented Apr 27, 2016

Awesome :) Thanks!

@xibz
Copy link
Contributor

xibz commented Apr 27, 2016

@stack72 - CloudWatch Logs states it happens immediately. Are you doing something that has unexpected output?

@stack72
Copy link
Author

stack72 commented Apr 27, 2016

Hi @xibz

I am trying to get this working now. If the Cloudwatch Logs say it works as so then I will find the fix on my side. I will close the issue until it has been proven otherwise

Thanks for all the work here

Paul

@stack72 stack72 closed this as completed Apr 27, 2016
@xibz
Copy link
Contributor

xibz commented Apr 27, 2016

@stack72 - Thank you again for reaching out to us. If you have any issues, please reopen so we can properly get this handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information. service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

3 participants