Welcome! Log In Create A New Profile

Advanced

Re: $request_id not logged in the nginx logs

Liu Lantao
June 28, 2017 02:54AM
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@serversolution.info> wrote:
>
> Nobody use this variable?
>
>> On Jun 26, 2017, at 2:28 PM, Georgi Georgiev <georgi@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@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

$request_id not logged in the nginx logs

Georgi Georgiev June 26, 2017 07:30AM

Re: $request_id not logged in the nginx logs

Georgi Georgiev June 28, 2017 01:54AM

Re: $request_id not logged in the nginx logs

Liu Lantao June 28, 2017 02:54AM

Re: $request_id not logged in the nginx logs

Georgi Georgiev June 28, 2017 02:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 176
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready