cookbook 'logrotate-s3', '~> 0.2.1'
logrotate-s3 (2) Versions 0.2.1 Follow1
Installs/Configures Logrotate to move files to S3
cookbook 'logrotate-s3', '~> 0.2.1', :supermarket
knife supermarket install logrotate-s3
knife supermarket download logrotate-s3
Cookbook logrotate-s3
This cookbook offers two custom resources that can be used to configure S3 access, and then setup log rotation for any number of log files.
logrotate
Installs S3 upload script, and offers reusable resource for adding logs to the rotate schedule.
This cookbook uses package s3cmd
to actually upload gzipped log files that have been rotated by logrotate
.
Usage
First we must configure s3cmd
so that it has access to S3:
logrotate_s3_config
logrotate_s3_config '/etc/logrotate-s3.conf' do s3_aws_region 'us-east-2' s3_access_key 'AFLKJLKJIERFKFJKDJFKDJ' s3_secret_key 'fjf09f9gf80ds8fg09f8gdfsg789sdf7' end
logrotate_s3_file
Once configuration is in place, here is how you can wrap a log files produced by nginx
in a proper rotation schedule, with upload of the gzipped files to S3.
logrotate_s3_file 'nginx' do s3_config '/etc/logrotate-s3.conf' log_dir '/var/log/nginx' rotate 5 s3_bucket 'rotated-logs' upload_to_s3 true end
Note that the actual location on S3 will be constructed as
s3//{{ s3_bucket }}/{{ s3_folder or chef environment }}/nginx/logfile.gz
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/kigster/cookbook-logrotate-s3.
License
© 2018 Konstantin Gredeskoul, All rights reserved. MIT License.
Acknowledgements
- Jordan Brown @ Homebase
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
0.2.1 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.2.1 passed this metric
No Binaries Metric
0.2.1 passed this metric
Testing File Metric
0.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.1 failed this metric
0.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.2.1 passed this metric
No Binaries Metric
0.2.1 passed this metric
Testing File Metric
0.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.1 passed this metric
0.2.1 passed this metric
Testing File Metric
0.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.1 failed this metric
0.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number