Welcome! Log In Create A New Profile

Advanced

using uninitialized "pat" variable while logging request

Toni Mueller
November 15, 2013 05:26PM
Hi,

to debug my locations, I have a variable in my configuration that I
reference during logging. The log format, included from nginx.conf:

log_format mylogformat '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" domain: $host branch: $pat';


Unfortunately, I cannot set the variable $pat already in nginx.conf,
but in my virtual server configuration, I set it like this:

server {
listen 1.2.3.4:80 default_server;
server_name www.example.com;

charset utf-8;
set $pat "-";

# rest of configuration here, eg.:

location = / {
set $pat "homepage";
# do something special
}

# more stuff...
}


So far, my understanding is that the variable $pat should be _always_
defined, right? Well... I find this in the error log:

[warn] 11092#0: *15719589 using uninitialized "pat" variable while logging request, client: 4.3.2.1, server: www.example.com


For a lot of requests, the value of the variable does appear in the log
file, but for a good proportion, it doesn't. I would like to have this
variable always set properly. Can it be a timing question? I get
between ~5 and below 100 requests per second. The machine doesn't look
anywhere near loaded, though (CPU utulization is under 5%).

My software is nginx-full 1.2.1-2.2+wheezy1, on an amd64 VM.


TIA!


Kind regards,
--Toni++

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

using uninitialized "pat" variable while logging request

Toni Mueller November 15, 2013 05:26PM

Re: using uninitialized "pat" variable while logging request

Valentin V. Bartenev November 15, 2013 07:08PM

Re: using uninitialized "pat" variable while logging request

Toni Mueller November 15, 2013 08:04PM

Re: using uninitialized "pat" variable while logging request

Jonathan Matthews November 16, 2013 03:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 164
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