Is it possible to add nginx cache hash to the log?
April 07, 2022 03:45AM
Hi guys!

I have an nginx cache server with a simple basic config, nothing special.

nginx version: openresty/1.13.6.1
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
built with OpenSSL 1.0.2k 26 Jan 2017
TLS SNI support enabled

log:

172.18.0.1 HIT -- - - 0.000 - - [06/Apr/2022:17:33:00 +0000] "HEAD /custom/xxxx/image/product/12.jpg HTTP/2.0" 200 0 "-" "curl/7.68.0" "-"
This file cache version is stored under custom folder /tmp/cache1.
What i want, is display the cache hash in the log file.
Eg. the cache hash for this file is:

/tmp/cache1/a/0/e6920f37af6df573815a02933c7f480a
And what i want to see:

172.18.0.1 HIT -- - - 0.000 - - [06/Apr/2022:17:33:00 +0000] "HEAD /custom/xxxx/image/product/12.jpg HTTP/2.0" | e6920f37af6df573815a02933c7f480a | 200 0 "-" "curl/7.68.0" "-"

Is it possible? Have any built-in variable to display this hash in the log files?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 254
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready