An open API service indexing awesome lists of open source software.

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

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
}
```