セキュリティ要件等で、各サーバのログを長期保存しなければいけない場合、 サーバ上(EBS)に全ログを保存するとエライことになるので、S3に退避する 方法をメモ。 Linux標準の logrotate + s3cmd を駆使して実現できます。 # 巷で話題のfluentdやfluent-agent-liteも検討しましたが、やりたい事は # 単純で、EC2外に大量の過去ログを保存したいだけなので、logrotateでさく # っと実装。 /etc/logrotate.d/syslog の場合 /var/log/messages /var/log/xxxx { copytruncate sharedscripts postrotate /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true ends
