$request_length outside of log module

Hi
Over time you have been adding functionality to use log variables
outside of log module, e.g.

Changes with nginx 1.3.8 30 Oct 2012
*) Feature: the $bytes_sent, $connection, and $connection_requests
variables can now be used not only in the “log_format” directive.

Changes with nginx 1.3.9 27 Nov 2012
*) Feature: the $request_time and $msec variables can now be used not
only in the “log_format” directive.

Are you going to add the $request_length variable to this list too?

Many thanks

On 28 January 2013 13:56, Richard K. [email protected]
wrote:

in the “log_format” directive.

Are you going to add the $request_length variable to this list too?

I would think you could get something equivalent and useful out of
$upstream_http_content_length, as per
http://wiki.nginx.org/HttpUpstreamModule#.24upstream_http_.24HEADER .
YMMV.


Jonathan M. // Oxford, London, UK
http://www.jpluscplusm.com/contact.html

Hi,
It’s not the same, $request_length is the length of what the client
(browser) sent it’s request for a file e.g. request headers, request
body
I suppose I could loop through the headers and body and count their
lengths… but not ideal

Hello!

On Mon, Jan 28, 2013 at 01:56:46PM +0000, Richard K. wrote:

not only in the “log_format” directive.

Are you going to add the $request_length variable to this list too?

It’s already done:

http://trac.nginx.org/nginx/changeset/5011/nginx


Maxim D.
http://nginx.com/support.html

yeah, it’s different (correct) definition here:
http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
should probably update wiki to reflect it

I think $http_content_length will give the length of the response also
(not the request)

As Maxim says, they added it to the trunk a few days ago and I don’t
mind waiting for next release :slight_smile:

Thanks all

On 28 January 2013 14:15, Richard K. [email protected]
wrote:

lengths… but not ideal
My bad - I misread your original email.

$request_length is actually defined here
(http://wiki.nginx.org/HttpLogModule#log_format) as the request
/body/'s length, i.e. not counting headers. You might get something
useful out of $http_content_length instead.

Jonathan

Jonathan M. // Oxford, London, UK
http://www.jpluscplusm.com/contact.html

On 28 January 2013 14:38, Richard K. [email protected]
wrote:

yeah, it’s different (correct) definition here:
http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
should probably update wiki to reflect it

Ah yes, you’re right. Haven’t see a doc/wiki mismatch like that before!

I think $http_content_length will give the length of the response also (not
the request)

I don’t think it will.
http://wiki.nginx.org/HttpCoreModule#.24http_HEADER says it’ll be the
request header.

I hadn’t noticed $sent_http_* before - handy!

Jonathan

Jonathan M. // Oxford, London, UK
http://www.jpluscplusm.com/contact.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs