LoginSignup
23
22

More than 5 years have passed since last update.

AWSで動かしてるサーバのApacheとTomcatのログのタイムスタンプがずれている

Posted at

AWSに置いてあるアプリケーションサーバのログを監視していたら
ApacheとTomcatのログの時刻が9時間ずれている...
access_logがJSTで、TomcatログがUTCで記録されている模様

/var/log/httpd/access_log

xxx.xxx.xxx.xxx - - [14/Nov/2013:15:00:00 +0900] "GET (以下略)

log4jで出してるTomcat配下のアプリケーションログ

2013/11/14 06:00:00 INFO (以下略)

!!?
ちなみにdateコマンドのlocaleはあってるっぽい

diff /etc/localtime /usr/share/zoneinfo/Japan 
# なし

ぬーん。
とりあえずログの時刻がズレてると色々支障があるので設定を追加

setenv.sh

(Tomcatインストールディレクトリ)/bin/ に setenv.sh を作っておいとく

CATALINA_OPTS='-Duser.timezone=Asia/Tokyo'
export CATALINA_OPTS

Tomcatを再起動したら、タイムスタンプが揃ったー

23
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
22