NAME

Tail::Stat::Plugin::nginx - Statistics collector for Nginx web-server

SYNOPSIS

tstatd -o clf nginx httpd.access_log

LOG FORMATS

Nginx has predefined (compiled in) log format named combined. This format defined as:

log_format combined '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent"';

This format produces such lines:

1.2.3.4 - - [22/Jan/2010:19:34:21 +0300] "GET /foo/ HTTP/1.1" 200 11078 "http://www.rambler.ru/" "Mozilla/5.0 (Windows; U; Windows NT 5.1"

For collecting statistics about request timing, upstream delays and cache efficiency it's recommended to extend log format:

log_format extended '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" ' 'rt=$request_time ut="$upstream_response_time" ' 'cs=$upstream_cache_status';

Extended format creates log records like this:

1.2.3.4 - - [22/Jan/2010:19:34:21 +0300] "GET /foo/ HTTP/1.1" 200 11078 "http://www.rambler.ru/" "Mozilla/5.0 (Windows; U; Windows NT 5.1" rt=0.010 ut="2.001, 0.345" cs=MISS

OPTIONS

clf

Simplify regular expression (don't accumulate information about client/upstream timings and cache status).

STATISTICS

Overall statistics

HTTP traffic

http_request

Total number of served requests.

http_byte

Total number of sent bytes.

malformed_request

Total number of malformed requests.

HTTP methods

http_method_head

Total number of served HEAD requests.

http_method_get

Total number of served GET requests.

http_method_inc

Total number of served subrequests.

http_method_post

Total number of served POST requests.

http_method_other

Total number of served another types of requests.

HTTP versions

http_version_0_9

Total number of served HTTP/0.9 requests.

http_version_1_0

Total number of served HTTP/1.0 requests.

http_version_1_1

Total number of served HTTP/1.1 requests.

HTTP statuses

http_status_xxx

Total number of served requests with status of xxx.

http_status_1xx

Total number of served requests with status of 100-199.

http_status_2xx

Total number of served requests with status of 200-299.

http_status_3xx

Total number of served requests with status of 300-399.

http_status_4xx

Total number of served requests with status of 400-499.

http_status_5xx

Total number of served requests with status of 500-599.

Cache statuses

NOTE: available unless clf option in use.

cache_status_expired

Total number of served request with cache status EXPIRED.

cache_status_hit

Total number of served request with cache status HIT.

cache_status_miss

Total number of served request with cache status MISS.

cache_status_stale

Total number of served request with cache status STALE.

cache_status_updating

Total number of served request with cache status UPDATING.

Upstream requests

NOTE: available unless clf option in use.

upstream_request

Total number of requests proxied to upstreams.

upstream_next_count

Total number of switching between upstreams.

Last statistics

HTTP traffic

last_http_request

Total number of served requests during last window.

last_http_byte

Total number of sent bytes during last window.

last_request_time

Total amount of time elapsed to serve requests during last window.

NOTE: available unless clf option in use.

Upstream requests

NOTE: available unless clf option in use.

last_upstream_request

Total number of proxied requests during last window.

last_upstream_time

Total amount of time elapsed to proxying requests during last window.

AUTHOR

Oleg A. Mamontov, <oleg@mamontov.net>

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.