nginx log_format 中的变量
前言
- nginx1.15
log_format 中的變量
$scheme :請求的協議,比如http、https;
$host :請求的地址(IP或域名),比如127.0.0.1、localhost、baidu.com、www.baidu.com;
$server_port :請求的端口,比如80、443、8080,
$remote_addr :客戶端的ip地址;
$remote_user :記錄客戶端用戶的名稱;
$time_local :訪問時間及時區;
$request :請求的URL與HTTP協議,比如GET /index HTTP/1.0;
$status :記錄請求狀態,比如200、404;
$body_bytes_sent:記錄發送給客戶端文件主體內容大小;
$bytes_sent :客戶端發送的字節數
$request_length:客戶端請求的長度
$upstream_status:upstream狀態
$upstream_addr :后臺upstream的地址,即真正提供服務的主機地址
$request_time : 整個請求的總時間
$upstream_response_time:請求過程中,upstream響應時間
$request_body :POST數據
$http_NAME :匹配任意請求頭字段,NAME可以替換成任意請求頭字段。比如$http_accept_language獲取http請求頭Accept-Language;
$http_host :請求的地址(IP或域名),如果http協議頭包含host,則對應http協議頭的host,否則同$host;
$http_referer:用來記錄從哪個頁面鏈接訪問過來的,對應http協議頭的referer;
$http_user_agent:記錄客戶端瀏覽器的相關信息,對應http協議頭的user-agent(規律:橫線變成下劃線了);
$http_x_forwarded_for : 對應http協議頭的x-forwarded-for,含義同$remote_addr,用于反向代理時告知應用客戶端的實際IP;
$http_x_forwarded_proto : 對應http協議頭的x-forwarded-proto,含義同$scheme,用于反向代理時告知應用客戶端的實際請求協議;
$http_cookie : 全部的cookie;
$sent_http_NAME :http響應頭字段,NAME可以替換成任意響應頭字段。如$sent_http_content_length獲取響應頭Content-length;
$sent_http_cache_control:
$sent_http_connection:
$sent_http_content_type:
$sent_http_keep_alive:
$sent_http_last_modified:
$sent_http_location:
$sent_http_transfer_encoding:
$cookie_NAME :客戶端請求Header頭中的cookie變量,NAME可以替換成任意cookie名稱。比如$cookie_jsessionid獲取cookie中的jsessionid;
參考
http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
https://www.cnblogs.com/luoyan01/p/9734149.html
總結
以上是生活随笔為你收集整理的nginx log_format 中的变量的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: nginx: [emerg] dupli
- 下一篇: 上睑下垂做了以后睫毛会变长吗