$request_id not logged in the nginx logs
Georgi Georgiev
georgi at serversolution.info
Wed Jun 28 06:55:47 UTC 2017
Thank you! It works now, but still only in response headers, not in request headers. Is it normal behavior? Also how can I append the ID in the logs? I think that it should works by this way by default?
> On Jun 28, 2017, at 9:52 AM, Liu Lantao <liulantao at gmail.com> wrote:
>
> Please try to append ‘always' at the end of ‘add_header’ line.
>
>
> http://nginx.org/en/docs/http/ngx_http_headers_module.html#add_header
>
> If the always parameter is specified (1.7.5), the header field will be added regardless of the response code.
>
>
>> On Jun 28, 2017, at 1:52 PM, Georgi Georgiev <georgi at serversolution.info> wrote:
>>
>> Nobody use this variable?
>>
>>> On Jun 26, 2017, at 2:28 PM, Georgi Georgiev <georgi at serversolution.info> wrote:
>>>
>>> Hello,
>>> I have enabled request_id headers in nginx (which works as reverse proxy) by the following way:
>>>
>>> In nginx.conf my log format hs included $request_id as follows:
>>>
>>> log_format main '$remote_addr - $remote_user [$time_local] "$request" '
>>> '$status $body_bytes_sent $request_id "$http_referer" '
>>> '"$http_user_agent" "$http_x_forwarded_for”';
>>>
>>>
>>> In the ghost configs I have headers like the following:
>>> location / {
>>> ...
>>> add_header X-Request-Id $request_id;
>>> proxy_set_header X-Request-Id $request_id;
>>>
>>> I would ike to accomplish the following thing.
>>>
>>> 1. In all logs and all requests (access, error, mod security audit logs) the request_id to be logged (as it should be, but currently not work).
>>> 2. When I open the site X-Request-ID to be set in request headers, not only in response headers. Currently I have the x-request-id header only in the response headers.
>>> 3. When I have been blocked my some mod security rule with status 403 the headers to be present and the id to be logged too in the logs. Currently on 403 response I haven’t the header neither in request headers and response headers (only on normal query).
>>>
>>> Can you please explain me where I am wrong? Thank you in advance.
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list