[3.0] 2ee9351 Add support for the %{format}t construct to varnishncsa

Tollef Fog Heen tfheen at varnish-cache.org
Mon Apr 16 10:20:37 CEST 2012


commit 2ee935102094cbc1fab646ccea37694a5516a98c
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Mon Jan 16 10:12:14 2012 +0100

    Add support for the %{format}t construct to varnishncsa

diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index ae3e4cb..ff07ed5 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -749,6 +749,11 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
 				VSB_cat(os, h ? h : "-");
 				p = tmp;
 				break;
+			case 't':
+				strftime(tbuf, sizeof tbuf, fname, &lp->df_t);
+				VSB_cat(os, tbuf);
+				p = tmp;
+				break;
 			case 'x':
 				if (strcmp(fname, "Varnish:time_firstbyte") == 0) {
 					VSB_cat(os, lp->df_ttfb);
diff --git a/doc/sphinx/reference/varnishncsa.rst b/doc/sphinx/reference/varnishncsa.rst
index 0b3f97f..9373f5c 100644
--- a/doc/sphinx/reference/varnishncsa.rst
+++ b/doc/sphinx/reference/varnishncsa.rst
@@ -90,6 +90,11 @@ The following options are available:
 	         Time when the request was received, in HTTP date/time
 	         format.
 
+	      %{X}t
+	         Time when the request was received, in the format
+		 specified by X.  The time specification format is the
+		 same as for strftime(3).
+
 	      %U
 	         The request URL without any query string. Defaults to
                  '-' if not known.



More information about the varnish-commit mailing list