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

How to clean history logs safely ? #5

Closed
iambocai opened this issue Dec 27, 2016 · 4 comments
Closed

How to clean history logs safely ? #5

iambocai opened this issue Dec 27, 2016 · 4 comments

Comments

@iambocai
Copy link

RT, is there any suggestions? it seems all run history stored in logs dir, is it safe to complete erase everything under that dir ?

@jhuckaby
Copy link
Owner

Sure, you can periodically delete everything in the log dir if you want, and that shouldn't break anything, but Cronicle does come with a nightly log archiver feature, if you want to use it. Just set this config param to a destination directory path, and all the logs will be gzipped, date/time stamped and stored there for you, wiping the logs directory as it does it:

https://github.com/jhuckaby/Cronicle#log_archive_path

log_archive_path

Every night at midnight (local server time), the logs can be archived (gzipped) to a separate location. This parameter specifies the path, and the directory naming / filenaming convention of the archive files. It can utilize date placeholders including [yyyy], [mm] and [dd].

This can be a partial path, relative to the Cronicle base directory (/opt/cronicle) or a full path to a custom location. It defaults to logs/archives/[yyyy]/[mm]/[dd]/[filename]-[yyyy]-[mm]-[dd].log.gz.

@iambocai
Copy link
Author

It works, thanks @jhuckaby ! I should read the manual first, hah~

@healthiansdotcom
Copy link

Is there any way to move the archived files to S3 to free-up disk space on the local disk?

@jhuckaby
Copy link
Owner

@healthiansdotcom That feature is coming in Cronicle v2, but for v1 you can do it fairly easily with the AWS CLI, assuming you have that installed. Add this to a crontab or Cronicle shell event to run nightly:

aws s3 cp /opt/cronicle/logs/archives s3://YOUR_BUCKET/YOUR_PATH/
rm -rf /opt/cronicle/logs/archives/*

The logs are archived every night at midnight, so it's better to avoid that hour, and run this later in the morning, maybe 3 AM.

Hope this helps!

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

No branches or pull requests

3 participants