使用 log4j 和 Elastic Beanstalk 旋转 S3 日志记录 [英] Rotating S3 Logging using log4j with Elastic Beanstalk

查看:15
本文介绍了使用 log4j 和 Elastic Beanstalk 旋转 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.log1tail_catalina.log2tail_catalina.log3 等保存到我的 s3.

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

我什么都想要!!

推荐答案

我使用了 logrotates3cmdcron 的基本组合以非常简单的方式实现这一目标.

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 和 Elastic Beanstalk 旋转 S3 日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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