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

Implement log rotation #4620

Closed
garethbowen opened this issue Jun 12, 2018 · 10 comments
Closed

Implement log rotation #4620

garethbowen opened this issue Jun 12, 2018 · 10 comments
Assignees
Labels
Priority: 2 - Medium Normal priority Type: Performance Make something faster

Comments

@garethbowen
Copy link
Member

We need to implement some sort of log rotation, compression, and/or archival for all logs on the medic-os Docker images. This needs to be done for all logs (api, sentinel, couchdb, etc) to ensure we don't run out of space.

This needs to be done with thought to maintain ease of use, for example, the current log must always have the same name and recent logs (~ last 24 hours) must be easy to access (not zipped or backed up off server).

NB: alpha.dev medic-api log is currently 174MB.

cc @browndav @henokgetachew

@ghost
Copy link

ghost commented Jun 19, 2018

This should be currently performed by logrotate(1), and the naming issues should be gone now that gardener is gone. I suspect it might just not be switched on for the services that were migrated out of gardener due to an oversight; I'll take a look now and push a PR.

Do you have any strong preference on retention/turnover parameters other than the 24 hour turnover (e.g. additional size-based turnover)? We should be able to set these in one place (/etc/logrotate.conf) container-wide.

@ghost ghost self-assigned this Jun 19, 2018
@garethbowen
Copy link
Member Author

It'd be good to have a size-based turnover as well just in case something goes wrong and blows out the logs in a hurry. Ideally this would be set very high so it's only used as a safety net and logs are otherwise in 24 hours slices.

ghost pushed a commit to medic/medic-os that referenced this issue Jun 20, 2018
@ghost
Copy link

ghost commented Jun 20, 2018

In the future this can certainly be more DRY, but this gets the job done and we can move/consolidate/link the small duplicated per-package scripts at a later point.

@ghost
Copy link

ghost commented Jun 20, 2018

The DRY-ness issue is filed at medic/medic-os#10 and should be straightforward to do all at once.

@ghost ghost assigned henokgetachew and unassigned ghost Jun 21, 2018
@henokgetachew
Copy link
Contributor

LGTM. Also +1 for filing the DRY-ness issue.

@ngaruko
Copy link
Contributor

ngaruko commented Jul 24, 2018

Tested on alpha.dev. medic-sentinel log size looks pretty small (140kb), but medic-api log size looks a bit larger but definitely way smaller than the 174 MB.

/srv/storage/medic-api/logs# du -sh 26M

/srv/storage/medic-sentinel/logs# du -sh 140K

@garethbowen
Copy link
Member Author

@ngaruko The important thing isn't the size of the logs but that the logs split when they get big/old enough. You should see more than a single log file once the limit is hit.

@ngaruko
Copy link
Contributor

ngaruko commented Jul 24, 2018

Thanks @garethbowen. Do we know what that limit is for both sentinel and api?

@garethbowen
Copy link
Member Author

@henokgetachew @browndav What's the expected rotation strategy?

@ngaruko ngaruko self-assigned this Jul 24, 2018
@ghost
Copy link

ghost commented Jul 24, 2018

The rotation strategy is currently still logrotate, and the base configuration can be found here.

The missing log rotation for Horticulturalist-managed services is fixed in git and in the Docker 3.0.0-pre.01 on ECR, but unfortunately 3.0.0-pre.01 picked up a version of Horticulturalist that had bugs. As a result, the 3.0.0-pre.01 image isn't incredibly useful as-is.

We're building a 3.0.0-pre.02 with the latest version of Horticulturalist tomorrow morning, and should have it on ECR before end of day tomorrow.

When it's pushed to ECR and tested, we'll comment here and update the instructions in medic-infrastructure so that everyone's able to pull the new image and launch it on Docker CE (locally) or Docker Machine (on AWS).

@ngaruko ngaruko closed this as completed Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 2 - Medium Normal priority Type: Performance Make something faster
Projects
None yet
Development

No branches or pull requests

3 participants