-
Notifications
You must be signed in to change notification settings - Fork 25
/
README
41 lines (28 loc) · 1.19 KB
/
README
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
The ngx_http_requestid_module is designed to generate a unique request identificator with timestamp.
Since nginx 1.11.0 has introduced the $request_id variable, this module is useful only for older versions of nginx or if you need a timestamp prepended request identifier.
The module sets $trequest_id variable with a unique request ID.
The $trequest_id variable is composed of (time){13} and (md5(ngx_pid, connection_number, rand())){19}, where:
* time - timestamp in milliseconds
* ngx_pid - nginx process id
* connection_number - connection counter value local to worker process
* rand() - random number
Supports both old and new configuration methods including dynamic compilation.
Example configurations:
# Set Proxy Header
location / {
trequestid on;
proxy_pass http://127.0.0.1;
proxy_set_header X-Request-Id $trequest_id;
}
# Set HTTP Header
location / {
add_header X-Request-Id $trequest_id;
}
# Write request id to log
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent $trequest_id '
'"$http_referer" "$http_user_agent"';
Configuration:
syntax: trequestid on | off
default: off
context: server, location