summaryrefslogtreecommitdiff
path: root/pod/nginx/ngx_http_session_log_module.pod
blob: cc8ed54d66f07fbb97fec9c2f29ff7165d1c21cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
=encoding utf-8

=head1 NAME

ngx_http_session_log_module - Module ngx_http_session_log_module




=head1



The C<ngx_http_session_log_module> module enables logging
sessions (that is, aggregates of multiple HTTP requests) instead of
individual HTTP requests.






B<NOTE>

This module is available as part of our
commercial subscription.





=head1 Example Configuration



The following configuration sets up a session log and maps requests to
sessions according to the request client address and C<User-Agent>
request header field:

    
        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;
        }






=head1 Directives

=head2 session_log


B<syntax:> session_log I<I<C<name>> E<verbar> C<off>>


B<default:> I<off>


B<context:> I<http>


B<context:> I<server>


B<context:> I<location>





Enables the use of the specified session log.
The special value C<off> cancels the effect
of the C<session_log> directives
inherited from the previous configuration level.







=head2 session_log_format


B<syntax:> session_log_format I<
    I<C<name>>
    I<C<string>> ...>


B<default:> I<combined "...">


B<context:> I<http>





Specifies the output format of a log.
The value of the C<$body_bytes_sent> variable is aggregated across
all requests in a session.
The values of all other variables available for logging correspond to the
first request in a session.







=head2 session_log_zone


B<syntax:> session_log_zone I<
    I<C<path>>
    C<zone>=I<C<name>>:I<C<size>>
    [C<format>=I<C<format>>]
    [C<timeout>=I<C<time>>]
    [C<id>=I<C<id>>]
    [C<md5>=I<C<md5>>]
>



B<context:> I<http>





Sets the path to a log file and configures the shared memory zone that is used
to store currently active sessions.





A session is considered active for as long as the time elapsed since
the last request in the session does not exceed the specified
C<timeout> (by default, 30 seconds).
Once a session is no longer active, it is written to the log.





The C<id> parameter identifies the
session to which a request is mapped.
The C<id> parameter is set to the hexadecimal representation
of an MD5 hash (for example, obtained from a cookie using variables).
If this parameter is not specified or does not represent the valid
MD5 hash, nginx computes the MD5 hash from the value of
the C<md5> parameter and creates a new session using this hash.
Both the C<id> and C<md5> parameters
can contain variables.





The C<format> parameter sets the custom session log
format configured by the L</session_log_format> directive.
If C<format> is not specified, the predefined
“C<combined>” format is used.







=head1 Embedded Variables



The C<ngx_http_session_log_module> module supports
two embedded variables:


=over



=item C<$session_log_id>




current session ID;



=item C<$session_log_binary_id>





current session ID in binary form (16 bytes).




=back