LoginSignup
44
45

More than 5 years have passed since last update.

ApacheとNginxのログフォーマット比較

Posted at

ApacheとNginxのログフォーマット比較

Apache Nginx Description 説明
%a $remote_addr Remote IP address リモート IP アドレス
%A $server_addr Server IP address ローカル IP アドレス
%B $body_bytes_sent Bytes sent レスポンスのバイト数 HTTP ヘッダは除く
%b $body_bytes_sent Bytes sent (0 = '-') レスポンスのバイト数。HTTP ヘッダは除く CLF 書式 0のときは-(ハイフン)になる
%D - processing time[microsec] リクエストを処理するのにかかった時間、マイクロ秒単位
%f $request_filename Requested File path リクエストされたファイル名
%h - Remote Host リモートホスト名
%H $server_protocol Request protocol リクエストプロトコル名
%K - KeepAlive Connection keepaliveのコネクション数
%l - Remote Log Name リモートログ名
%m $request_method Request Method "リクエストメソッド(GET
%p $server_port Server Port リクエストを受けたポート番号
%P $pid Process ID 子プロセスID
%q $query_string Query String e.g.http://example.com/test.php?id=12345 -> ?id=12345 クエリ文字列
%r $request "First Line of Request リクエストの最初の行 基本的には%m %U$q %Hとした内容と同じ
%s $status Status Code ステータスコード
%t $time_local Request Time[11/Aug/2017:12:34:56 +0900] リクエストを受け付けた日時
%{format}t - Request Time with custom format (refer: strftime(3) format で与えられた書式による時刻
%T $request_time Proccessing Time リクエストを受けてから応答するまでの処理時間[秒] %Dの秒数版 Nginxはミリ秒まで
%u $remote_user Remote user リモートユーザ
%U $request_uri Request Path リクエストされたパス
%v $server_name Server name サーバーのServerName
%V $server_name Server name(UseCanonicalName) UseCanonicalNameで指定されたサーバー名
%X $request_completion Connection status X=aborted + = kept alive - = closed 応答が完了したときの接続ステータス
%I $request_length Bytes received including request and headers リクエストとヘッダを含む受け取ったバイト数
%O $bytes_sent Bytes sent including headers ヘッダを含むサーバーから送信されたバイト数
%{Referer}i $http_referer Referer リファラー
%{User-Agent}i $http_user_agent User Agent エージェント

Nginxのみ

Format Description
$args arguments in the request line
$binary_remote_addr $remote_addrのバイナリ版
$connection connection serial number
$connection_requests current number of requests made through a connection
$content_length “Content-Length” request header field
$content_type “Content-Type” request header field
$document_root root or alias directive’s value for the current request
$document_uri same as $uri
$host Server Host
$hostname host name
$https “on” if connection operates in SSL mode, or an empty string otherwise
$limit_rate setting this variable enables response rate limiting
$msec current time in seconds with the milliseconds resolution
$nginx_version nginx version
$pipe “p” if request was pipelined, “.” otherwise
$proxy_protocol_addr client address from the PROXY protocol header, or an empty string otherwise
$realpath_root $document_rootのリアルパス
$remote_port クライアントのポート
$request_body request body
$request_body_file name of a temporary file with the request body
$scheme http
$sent_http_name arbitrary response header field
$time_iso8601 local time in the ISO 8601 standard format

参考URL
楪総研第三分室
apache log format
nginx log variables

44
45
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
44
45