https://github.com/sethblack/logrotate-to-s3
A simple configuration for logrotate that will upload rotated files to S3
https://github.com/sethblack/logrotate-to-s3
aws aws-s3 bash bash-script linux linux-utility logging logrotate logrotate-cookbook shell
Last synced: 3 months ago
JSON representation
A simple configuration for logrotate that will upload rotated files to S3
- Host: GitHub
- URL: https://github.com/sethblack/logrotate-to-s3
- Owner: sethblack
- Created: 2019-12-03T03:06:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-03T04:22:01.000Z (over 5 years ago)
- Last Synced: 2025-01-30T23:42:46.308Z (5 months ago)
- Topics: aws, aws-s3, bash, bash-script, linux, linux-utility, logging, logrotate, logrotate-cookbook, shell
- Language: Shell
- Size: 1000 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Logrotate to S3
Configuration for logrotate to upload files to S3 for future processing.
## Setup
Install aws cli
```sh
pip install awscli
```Move s3upload.sh to `/etc/logrotate.d/s3/s3upload.sh`
edit /etc/logrotate.d/nginx
```
/var/log/nginx/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 0640 www-data adm
dateext
sharedscripts
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi \
endscript
postrotate
/etc/logrotate.d/s3/s3upload.sh
invoke-rc.d nginx rotate >/dev/null 2>&1
endscript
}
```