Bootstrap

日志文件上传s3

#/bin/bash

nginx_channel_time=`date -d '1 hour ago' +%Y-%m-%d-%H`
nginx_channel_logs_path="/var/log/www/xxxx/"
hostname=`hostname`
nginx_channel_logname="traffic_channel.log-${nginx_channel_time}"

mv ${nginx_channel_logs_path}/${nginx_channel_logname} ${nginx_channel_logs_path}/${nginx_channel_logname}.${hostname}

gzip ${nginx_channel_logs_path}/${nginx_channel_logname}.${hostname}

Year=`date  +%Y`
Mon=`date  +%m`
Day=`date +%d`



# upload nginx channel to s3
/usr/bin/aws s3 sync $nginx_channel_logs_path/ s3://lweblog/nginxlog/xxx/$Year/$Mon/$Day --acl private --exclude "*" --include "${nginx_channel_logname}.${hostname}.gz"
;