非常教程

Nginx参考手册

ngx_http_session_log_module

ngx_http_session_log_module

  • 示例配置
  • 指令
  • session_log_format
  • session_log_zone
  • session_log
  • 嵌入式变量

ngx_http_session_log_module模块启用日志记录会话(即多个HTTP请求的聚合)而不是单独的HTTP请求。

此模块可作为我们商业订阅的一部分。

示例配置

以下配置根据请求客户端地址和“User-Agent”请求标头字段设置会话日志并将请求映射到会话:

    session_log_zone /path/to/log format=combined
                     zone=one:1m timeout=30s
                     md5=$binary_remote_addr$http_user_agent;

    location /media/ {
        session_log one;
    }

指令

句法:

session_log_format name string ...;

默认:

session_log_format结合“...”;

语境:

HTTP

指定日志的输出格​​式。$body_bytes_sent变量的值在会话中的所有请求中汇总。可用于记录的所有其他变量的值对应于会话中的第一个请求。

句法:

session_log_zone path zone = name:size format = format id = id;

默认:

语境:

HTTP

设置日志文件的路径并配置用于存储当前活动会话的共享内存区域。

只要会话中上次请求的时间不超过指定时间timeout(默认为30秒),就认为会话处于活动状态。一旦会话不再有效,它将被写入日志。

id参数标识请求映射到的会话。该id参数设置为MD5哈希的十六进制表示(例如,使用变量从cookie中获取)。如果未指定此参数或者不代表有效的MD5散列值,nginx会根据md5参数值计算MD5散列值,并使用此散列值创建新会话。无论是idmd5参数可以包含变量。

format参数设置由session_log_format指令配置的自定义会话日志格式。如果format未指定,则使用预定义的“ combined”格式。

句法:

session_log名称| 关闭;

默认:

session_log off;

语境:

http,服务器,位置

启用使用指定的会话日志。 特殊值关闭会取消从以前的配置级别继承的所有session_log指令。

嵌入式变量

ngx_http_session_log_module模块支持两个嵌入式变量:

$ session_log_id当前会话ID; $ session_log_binary_id二进制形式的当前会话ID(16字节)。

ngx_http_session_log_module
Nginx

Nginx是一款轻量级的 Web 服务器/反向代理服务器及电子邮件代理服务器,可在 BSD-like 协议下发行。其特点是占有内存少,并发能力强。

主页 https://nginx.org/
源码 http://hg.nginx.org/nginx
发布版本 1.13.6

Nginx目录

1.指南 | Guides
2.核心 | Core
3.ngx_google_perftools_module
4.ngx_http_access_module
5.ngx_http_addition_module
6.ngx_http_api_module
7.ngx_http_auth_basic_module
8.ngx_http_auth_jwt_module
9.ngx_http_auth_request_module
10.ngx_http_autoindex_module
11.ngx_http_browser_module
12.ngx_http_charset_module
13.ngx_http_core_module
14.ngx_http_dav_module
15.ngx_http_empty_gif_module
16.ngx_http_f4f_module
17.ngx_http_fastcgi_module
18.ngx_http_flv_module
19.ngx_http_geoip_module
20.ngx_http_geo_module
21.ngx_http_gunzip_module
22.ngx_http_gzip_module
23.ngx_http_gzip_static_module
24.ngx_http_headers_module
25.ngx_http_hls_module
26.ngx_http_image_filter_module
27.ngx_http_index_module
28.ngx_http_js_module
29.ngx_http_keyval_module
30.ngx_http_limit_conn_module
31.ngx_http_limit_req_module
32.ngx_http_log_module
33.ngx_http_map_module
34.ngx_http_memcached_module
35.ngx_http_mirror_module
36.ngx_http_mp4_module
37.ngx_http_perl_module
38.ngx_http_proxy_module
39.ngx_http_random_index_module
40.ngx_http_realip_module
41.ngx_http_referer_module
42.ngx_http_rewrite_module
43.ngx_http_scgi_module
44.ngx_http_secure_link_module
45.ngx_http_session_log_module
46.ngx_http_slice_module
47.ngx_http_spdy_module
48.ngx_http_split_clients_module
49.ngx_http_ssi_module
50.ngx_http_ssl_module
51.ngx_http_status_module
52.ngx_http_stub_status_module
53.ngx_http_sub_module
54.ngx_http_upstream_conf_module
55.ngx_http_upstream_hc_module
56.ngx_http_upstream_module
57.ngx_http_userid_module
58.ngx_http_uwsgi_module
59.ngx_http_v2_module
60.ngx_http_xslt_module
61.ngx_mail_auth_http_module
62.ngx_mail_core_module
63.ngx_mail_imap_module
64.ngx_mail_pop3_module
65.ngx_mail_proxy_module
66.ngx_mail_smtp_module
67.ngx_mail_ssl_module
68.ngx_stream_access_module
69.ngx_stream_core_module
70.ngx_stream_geoip_module
71.ngx_stream_geo_module
72.ngx_stream_js_module
73.ngx_stream_limit_conn_module
74.ngx_stream_log_module
75.ngx_stream_map_module
76.ngx_stream_proxy_module
77.ngx_stream_realip_module
78.ngx_stream_return_module
79.ngx_stream_split_clients_module
80.ngx_stream_ssl_module
81.ngx_stream_ssl_preread_module
82.ngx_stream_upstream_hc_module
83.ngx_stream_upstream_module