LoginSignup
12
8

More than 5 years have passed since last update.

Apacheのログの日本語をデコードする

Posted at

Apacheのログは日本語がエスケープされておりそのまま読むことが出来ません。

次のコマンドでデコードできます。また、access_logとerror_logとでエスケープが違うので注意です。

access_log
tail -f access_log | perl -ne 'use URI::Escape; print uri_unescape($_);'
error_log
tail -f error_log | perl -nle 's/\\x(..)/pack("C",hex($1))/eg;print $_'

tail -fはログの末尾を常に表示し続けるコマンドです。ログが追加されると自動で追加された行が表示されます。

12
8
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
12
8