Adding cachekey to log_format directive

gmccullough nginx-forum at nginx.us
Fri Nov 16 17:23:42 UTC 2012


That depends on what you want...

If you want the raw cache key, it is stored as an array of strings
(r->cache->keys) that must be concatenated together to populate the variable
to log.

If you want the md5 hash of the raw cache key, it is available in two
places:

The binary md5 value in r->cache->key, which would require using
ngx_hex_dump to make it into a hexadecimal string to log.

A bit of a kludge, but the filename in the string r->cache->file.name
contains it, but you'd have to backwards search it for the last '/' to get
just the hash value.

Graham McCullough
Senior Software Engineer
Internap Network Services

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,232747,232921#msg-232921



More information about the nginx mailing list