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

feat: DPE-5656 log rotation new options #597

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

paulomach
Copy link
Contributor

@paulomach paulomach commented Jan 24, 2025

Issue

DA124 implementation

Solution

Adds:

  • new config option for log retention period
  • new config option for audit log policy
  • dynamic behavior for log compression and log retention period, depending on COS/logs being pushed.

Fixes #539

Copy link
Contributor

@sinclert-canonical sinclert-canonical left a comment

Choose a reason for hiding this comment

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

Initial code revision, requested by Paulo.

config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
scripts/wait_for_log_sync.sh Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/log_rotation_setup.py Outdated Show resolved Hide resolved
src/mysql_vm_helpers.py Outdated Show resolved Hide resolved
Copy link
Contributor

@shayancanonical shayancanonical left a comment

Choose a reason for hiding this comment

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

The log-syncing script once a COS relation is formed that waits to ensure that logs are being synced before changing the logrotation config -> the whole mechanism seems clunky. However, it seems like a sure fire way of ensuring that logs are syncing before the logrotation config is changed

Another option would be to check grep mysql.*log ${POSTIONS_FILE} in the constructor of the charm (along with a no-op if the action is already taken) -> this will be unexpected-error proof with a retry mechanism built in (when the next update-status runs). Thoughts?

lib/charms/mysql/v0/mysql.py Show resolved Hide resolved
src/log_rotation_setup.py Outdated Show resolved Hide resolved
Copy link
Contributor

@sinclert-canonical sinclert-canonical left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks for addressing all my comments!

config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
@paulomach
Copy link
Contributor Author

The log-syncing script once a COS relation is formed that waits to ensure that logs are being synced before changing the logrotation config -> the whole mechanism seems clunky. However, it seems like a sure fire way of ensuring that logs are syncing before the logrotation config is changed

Another option would be to check grep mysql.*log ${POSTIONS_FILE} in the constructor of the charm (along with a no-op if the action is already taken) -> this will be unexpected-error proof with a retry mechanism built in (when the next update-status runs). Thoughts?

On point. I've refactored to remove the need of the custom event, and rely on update_status instead, since this can be somewhat lazy

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.

Log level and log retention ought to be operator-configurable
4 participants