使用旋转与log4j的弹性魔豆S3记录 [英] Rotating S3 Logging using log4j with Elastic Beanstalk

查看:219
本文介绍了使用旋转与log4j的弹性魔豆S3记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想每个日志文件传输到S3。有一个自动脚本,拿起 tail_catina.log 并覆盖任何东西在那里。

I'm trying to transfer each log file to s3. There is an automatic script that picks up tail_catina.log and overwrites anything there.

我希望每个日志文件: tail_catalina.log1 tail_catalina.log2 tail_catalina .log3 等保存到我的S3。

I want each log file: tail_catalina.log1, tail_catalina.log2, tail_catalina.log3 etc. saved to my s3.

我想要的一切!

推荐答案

我用的基本组合的 logrotate的 s3cmd 的cron 实现这个很简单。

I use a basic combination of logrotate, s3cmd, and cron to achieve this quite simply.

我已经在我的博客做了详细的书面记录和解释。它应该对任何运行在Linux环境中的Apache服务器。我希望人们能有所帮助,因为我花了几个小时,以获得细节敲定了。

I've done a detailed writeup and explanation on my blog. It should work for anyone running an Apache server on a linux environment. I hope folks find it helpful as it took me a few hours to get the details hammered out.

基本的脚本如下,请参阅博客张贴的逐行明细:

The basic script is below, see the blog posting for a line by line breakdown:

# rotate the logs!
# common settings
compress
compresscmd /bin/gzip
compressoptions -9
compressext .gz

dateext
dateformat -%Y-%m-%d-%s

rotate 3
nomail
missingok
daily
size 5k
create 640 username username

/var/logs/www.runpartner.com/*.log {
sharedscripts
postrotate
sudo /usr/sbin/apache2ctl graceful

/usr/bin/s3cmd sync /var/logs/www.runpartner.com/*.gz s3://bucket-logs/www.runpartner.com/
endscript
}

这篇关于使用旋转与log4j的弹性魔豆S3记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆