Skip to content

Implement CloudWatch Log Retention Management #4586

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lazyperson1020
Copy link
Contributor

@lazyperson1020 lazyperson1020 commented Apr 13, 2025

Fixes - #4585

This PR implements retention policy management for CloudWatch logs associated with EvalAI challenges. Currently, logs are retained indefinitely, which could lead to unnecessary costs. This implementation sets appropriate retention periods based on challenge end dates.
Changes -

  • Added function to calculate retention periods based on challenge end dates.
  • Added function to set CloudWatch log retention policies for challenge log groups.
  • Logs will be retained for 30 days after the challenge end date.
  • For active challenges, logs will be retained until the end date plus 30 days.
  • Retention periods are mapped to valid AWS CloudWatch values.

Reference
https://boto3.amazonaws.com/v1/documentation/api/1.26.93/reference/services/logs/client/put_retention_policy.html

@lazyperson1020
Copy link
Contributor Author

Sir please check these functions so that I can appropriately call them in other files.

@lazyperson1020 lazyperson1020 marked this pull request as draft April 13, 2025 05:52
Copy link
Member

@RishabhJain2018 RishabhJain2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lazyperson1020 , These functions looks good. Can you call this function when after you have created the task definition for AWS Fargate worker to update the log group?

@lazyperson1020
Copy link
Contributor Author

lazyperson1020 commented Apr 15, 2025

Can you call this function when after you have created the task definition for AWS Fargate worker to update the log group?

I have called the function in challenge_approval_callback , restart_workers_signal_callback and register_task_def_by_challenge_pk.

@lazyperson1020 lazyperson1020 marked this pull request as ready for review April 17, 2025 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants