jia Jimmy
jia Jimmy

Reputation: 1848

nginx: [emerg] unknown "upstream_connect_time" variable

I'm working with nginx/1.6.0 and I want to log upstream_connect_time and upstream_header_time with settings as below:

log_format  working_p '$remote_addr - $host [$time_local]\t'
                      '$request" $status $body_bytes_sent\t'
                      '"$http_referer" "$http_user_agent"\t'
                      'rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"\t'
                      '$http_x_forwarded_for ';

But I always get error

nginx: [emerg] unknown "upstream_connect_time" variable
test nginx conf fail. please check it first, we won't reload it

How can I get upstream_connect_time as expected?

Thanks

Upvotes: 0

Views: 1519

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146520

If you check the documentation this is available on 1.9.1+

$upstream_connect_time keeps time spent on establishing a connection with the upstream server (1.9.1); the time is kept in seconds with millisecond resolution. In case of SSL, includes time spent on handshake. Times of several connections are separated by commas and colons like addresses in the $upstream_addr variable.

https://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_connect_time

Upvotes: 1

Related Questions