• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

[置顶] 详细解释:nginx中ChsHttpLogModule模块配置及各

mysql 搞代码 4年前 (2022-01-09) 27次浏览 已收录 0个评论

ngx_http_log_module 实例: log_format gzip ‘$remote_addr – $remote_user [$time_local] ‘: ‘$request $status $bytes_sent ‘: ‘$http_referer $http_user_agent $gzip_ratio’;access_log /spool/logs/nginx-access.log gzip buffer=32k; access_log 语法

<link href=”/js/syntaxhighlighter/SyntaxHighlighter.css” rel=”stylesheet” type=”text/css” />

ngx_http_log_module
实例:

log_format  gzip  '$remote_addr - $remote_user [$time_local]  ': '"$request" $status $bytes_sent ': '"$http_referer" "$http_user_agent" "$gzip_ratio"';access_log  /spool/logs/nginx-access.log  gzip  buffer=32k;

access_log
语法: access_log path [format [buffer=size | off ] 默认值: access_log log/access.log combined

作用域: http, server, location

指令 access_log 指派路径、格式和缓存大小。参数 “off” 将清除当前级别的所有 access_log 指令。如果未指定格式,则使用预置的 “combined” 格式。缓存不能大于能写入磁盘的文件的最大大小。在 FreeBSD 3.0-6.0 ,缓存大小无此限制。

log_format
语法: log_format name format [format …]

默认值: log_format combined “…”

作用域: http server

Directive log_format describes the format of a log entry. Besides general variables in the format it is possible to use variables which exist only at the moment of record into the log:

$body_bytes_sent, the number of bytes, transmitted to client minus the response headers, variable is compatible with parameter %B of module Apache’s mod_log_config (this was called $apache_bytes_sent, before version 0.3.10)
$bytes_sent, the number of bytes, transmitted to client
$connection, the number of connection
$msec, the time with an accuracy to microseconds at the moment of the log entry
$pipe, “p” if request was pipelining
$request_length, the length of the body of the request
$request_time, the time of working on request in seconds
$status, status of answer
$time_local, local time into common log format.
The headers, transmitted to client, begin from the prefix “sent_http_”, for example, $sent_http_content_range.

本文来源gao@!dai!ma.com搞$$代^@码5网@

In the configuration there is always a predetermined format “combined”:

log_format  combined  '$remote_addr - $remote_user [$time_local]  ': '"$request" $status $apache_bytes_sent ': '"$http_referer" "$http_user_agent"';

原始俄文文档:http://sysoev.ru/nginx/docs/http/ngx_http_log_module.html


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:[置顶] 详细解释:nginx中ChsHttpLogModule模块配置及各

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址