天天看點

nginx日志詳解

文法: log_format name string …;

預設值: log_format combined “…”;

log_format  access_format  '$remote_addr - $remote_user [$time_local] "$request"

                        '$status $body_bytes_sent "$http_referer" '

                        '"$http_user_agent" "$http_x_forwarded_for"';

access_log logs/access.log access_format;

$remote_addr, $http_x_forwarded_for 記錄用戶端IP位址

$remote_user 記錄用戶端使用者名稱

$request 記錄請求的URL和HTTP協定

$status 記錄請求狀态

$body_bytes_sent 發送給用戶端的位元組數,不包括響應頭的大小; 該變量與Apache子產品mod_log_config裡的“%B”參數相容。

$bytes_sent 發送給用戶端的總位元組數。

$connection 連接配接的序列号。

$connection_requests 目前通過一個連接配接獲得的請求數量。

$msec 日志寫入時間。機關為秒,精度是毫秒。

$pipe 如果請求是通過HTTP流水線(pipelined)發送,pipe值為“p”,否則為“.”。

$http_referer 記錄從哪個頁面連結通路過來的

$http_user_agent 記錄用戶端浏覽器相關資訊

$request_length 請求的長度(包括請求行,請求頭和請求正文)。

$request_time 請求處理時間,機關為秒,精度毫秒; 從讀入用戶端的第一個位元組開始,直到把最後一個字元發送給用戶端後進行日志寫入為止。

$time_iso8601 ISO8601标準格式下的本地時間。

$time_local 通用日志格式下的本地時間。

本文轉自神ge 51CTO部落格,原文連結:http://blog.51cto.com/12218412/1869248

繼續閱讀