AWStats currently supports these gzip/deflate field formats:
%gzipin mod_gzip compression input bytes: In:XXX
%gzipout mod_gzip compression output bytes & ratio: Out:YYY:ZZpct.
%gzipratio mod_gzip compression ratio: ZZpct.
%deflateratio mod_deflate compression ratio with format: (ZZ)
However, nginx only provides:
$gzip_ratio – achieved compression ratio, computed as the ratio between the original and compressed response sizes.
For instance, a log entry like
my.vhost ip.address - [07/Feb/2014:20:51:40 +0100] "GET /my-url HTTP/1.1" 200 3021 "-" "Mozilla/5.0 (WhatsMyIP.org HTTP_Compression_Test) whatsmyip.org/ua" 2.96
means:
Uncompressed Page Size: 8.7 KB
Compressed Page Size: 2.9 KB
Savings: 66.2%
So the gzip_ratio = uncompressed/compressed = 8.7/2.9 = 2.96
Please provide this ratio as an AWStats field so that nginx gzip compression can be analyzed correctly.
Try the attached patch against AWStats 7.3 awstats.pl.
gzip_ratio can be quoted in nginx.conf:
or unquoted:
and should be referred to as 'gzipngx' in awstats.conf:
Note that any log entries not containing the gzip ratio (i.e. where you are using a different log_format but the same log file) will be considered corrupt by AWStats, so careful with your server log definitions!
Last edit: Rodney Hester 2015-03-27
Thanks, seems to work fine here! :)
I had $gzip_ratio interpreted as %other before, so the log file format didn't change, but thanks for the hint.