2011-01-07 15:59:52 +0900
HerokuのLoggingアドオンのheroku logs
で出力されるログは以下のようにタイムゾーンがJSTではない。
$ heroku logs | tail -5
2011-01-06T22:50:32-08:00 heroku[nginx]: GET /75?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Sooey+%28Sooey%29 HTTP/1.1 | 173.13.167.169 | 6184 | http | 200
2011-01-06T22:50:33-08:00 heroku[router]: GET journal.sooey.com/74 dyno=web.1 queue=0 wait=0ms service=146ms bytes=5677
2011-01-06T22:50:33-08:00 heroku[router]: GET journal.sooey.com/72 dyno=web.1 queue=0 wait=0ms service=114ms bytes=5368
2011-01-06T22:50:33-08:00 heroku[nginx]: GET /74?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Sooey+%28Sooey%29 HTTP/1.1 | 173.13.167.169 | 5729 | http | 200
2011-01-06T22:50:33-08:00 heroku[nginx]: GET /72?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Sooey+%28Sooey%29 HTTP/1.1 | 173.13.167.169 | 5419 | http | 200
このままだと色々面倒なので、ローカルタイムに変換するフィルタを作りました。
$ curl -o localtime.rb https://gist.github.com/raw/769207/23d812697bf8cf8e44a074a74f0e496adb4a8f80/localtime.rb
$ heroku logs | tail -5 | ruby localtime.rb
2011-01-07 15:50:32 +0900 heroku[nginx]: GET /75?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Sooey+%28Sooey%29 HTTP/1.1 | 173.13.167.169 | 6184 | http | 200
2011-01-07 15:50:33 +0900 heroku[router]: GET journal.sooey.com/74 dyno=web.1 queue=0 wait=0ms service=146ms bytes=5677
2011-01-07 15:50:33 +0900 heroku[router]: GET journal.sooey.com/72 dyno=web.1 queue=0 wait=0ms service=114ms bytes=5368
2011-01-07 15:50:33 +0900 heroku[nginx]: GET /74?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Sooey+%28Sooey%29 HTTP/1.1 | 173.13.167.169 | 5729 | http | 200
2011-01-07 15:50:33 +0900 heroku[nginx]: GET /72?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Sooey+%28Sooey%29 HTTP/1.1 | 173.13.167.169 | 5419 | http | 200
実質2行です。