5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Apache Httpd アクセスログ設定メモ

Posted at

Apache httpdのアクセスログでltsvで出力するための書式をメモ

基本的な書式

<key1>:<value1>\t<key2>:<value2>\t ...

apache httpd 設定

/etc/httpd/conf/httpd.conf
# LogFormat
LogFormat "domain:%V\tservername:%v\thost:%h\tserver:%A\tident:%l\tauthuser:%u\ttime:%{%Y-%m-%d %H:%M:%S %z}t\ttimestamp:%{%Y/%m/%d %H:%M:%S %z}t\tmethod:%m\treqpath:%U%q\tpath:%U\tquery:%q\tprotocol:%H\treq_status:%s\tstatus:%>s\tsize:%B\treferer:%{Referer}i\tagent:%{User-Agent}i\tagent_out:%{User-Agent}o\tresponse_time:%D\tcookie:%{cookie}i\tset_cookie:%{Set-Cookie}o\txforwardfor:%{X-Forwarded-For}i\tfilename:%f\tport:%p\tproc_id:%P\tpid:%{pid}P\trequest:%r\tcon_status:%X\trecv_size:%I\tsend_size:%O\texe_time:%T" ltsv

# ELBのヘルスチェックとfavicon.icoの出力の除外設定
SetEnvIf User-Agent "ELB-HealthChecker/1\.0" nolog
SetEnvIf Request_URI "/favicon.ico" nolog

# CustomLog 
CustomLog logs/access_log ltsv env=!nolog

その他 使えるかもしれないフォーマットをメモ

内容   フォーマット 表示例
エポック時間 %{%s}t 1410611033

フォーマット参考にしたURL

Apache モジュール mod_log_config
"時刻フォーマットドキュメント"

5
3
1

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
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?