Search This Blog

Loading...

Sunday, December 18, 2011

Custom Nginx logging format

I’m trying to figure out if my nginx proxy cache is working or not. Reference these pages to hopefully log cache hits and misses.
#I put this in my nginx vhost config file
log_format up_head ‘$remote_addr [$time_local]’ ‘upstream_cache_status $upstream_cache_status’;
 
#write log using the "up_head" format that I just defined.
access_log /path/to/log/access.log up_head;
Sample log output of the example defined above.
127.0.0.1 [16/Jan/2011:20:22:25 +0000]upstream_cache_status HIT
127.0.0.1 [16/Jan/2011:20:22:26 +0000]upstream_cache_status – 127.0.0.1 [16/Jan/2011:20:22:26 +0000]upstream_cache_status – 127.0.0.1 [16/Jan/2011:20:22:27 +0000]upstream_cache_status HIT
127.0.0.1 [16/Jan/2011:20:22:28 +0000]upstream_cache_status – 127.0.0.1 [16/Jan/2011:20:22:28 +0000]upstream_cache_status – 127.0.0.1 [16/Jan/2011:20:22:45 +0000]upstream_cache_status HIT

0 comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails