[master] 40cd5acc5 varnishstat: New -I and -X options

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Aug 31 16:00:08 UTC 2020


commit 40cd5acc5d5051cb9c01a537a363a83be46f91f5
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue Aug 25 18:14:38 2020 +0200

    varnishstat: New -I and -X options
    
    They map directly to VSC 'I' and 'X' arguments.

diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index 4215783c7..0d308055a 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -309,6 +309,8 @@ main(int argc, char * const *argv)
 		case 'j':
 			json = 1;
 			break;
+		case 'I':
+		case 'X':
 		case 'f':
 			AN(VSC_Arg(vsc, opt, optarg));
 			has_f = 1;
diff --git a/bin/varnishstat/varnishstat_options.h b/bin/varnishstat/varnishstat_options.h
index 35bdb5c11..b98ba11c0 100644
--- a/bin/varnishstat/varnishstat_options.h
+++ b/bin/varnishstat/varnishstat_options.h
@@ -55,9 +55,11 @@
 STAT_OPT_1
 VSC_OPT_f
 VUT_OPT_h
+VSC_OPT_I
 STAT_OPT_j
 STAT_OPT_l
 VUT_OPT_n
 VUT_OPT_t
 VUT_GLOBAL_OPT_V
+VSC_OPT_X
 STAT_OPT_x
diff --git a/bin/varnishtest/tests/u00005.vtc b/bin/varnishtest/tests/u00005.vtc
index bc6c79207..0ffe02465 100644
--- a/bin/varnishtest/tests/u00005.vtc
+++ b/bin/varnishtest/tests/u00005.vtc
@@ -22,7 +22,11 @@ shell -err "grep -q LCK.vbe.destroy ${p1_out}"
 process p2 {varnishstat -1 -n ${v1_name} -f ^*vbe.destroy -f *vbe* \
 	-f LCK.mempool.c* | tr '[1-9]' '0'} -run
 
+process p3 {varnishstat -1 -n ${v1_name} -X *vbe.destroy -I *vbe* \
+	-f LCK.mempool.c* | tr '[1-9]' '0'} -run
+
 shell "cmp -s ${p1_out} ${p2_out}"
+shell "cmp -s ${p1_out} ${p3_out}"
 
 shell -expect "MGT.uptime" \
 	"varnishstat -1 -n ${v1_name} -f ^MAIN*"
diff --git a/include/vapi/vapi_options.h b/include/vapi/vapi_options.h
index 8febf761b..ad5fe86a9 100644
--- a/include/vapi/vapi_options.h
+++ b/include/vapi/vapi_options.h
@@ -128,10 +128,32 @@
 /* VSC options */
 
 #define VSC_OPT_f							\
-	VOPT("f:", "[-f <glob>]", "Field inclusion glob",		\
-	    "Field inclusion glob."					\
+	VOPT("f:", "[-f <glob>]", "Legacy field filtering glob",	\
+	    "Legacy field filtering glob."				\
 	    " Use backslash to escape characters. If the argument"	\
 	    " starts with '^' it is used as an exclusive glob."		\
-	    " Multiple -f arguments may be given. Filtering globs"	\
-	    " are run in order on a first-match basis."			\
+	    " Multiple -f arguments may be given. Legacy filtering"	\
+	    " globs are run along with inclusion globs (-I arguments)"	\
+	    " and exclusion globs (-X arguments) in order on a"		\
+	    " first-match basis."					\
+	)
+
+#define VSC_OPT_I							\
+	VOPT("I:", "[-I <glob>]", "Field inclusion glob",		\
+	    "Field inclusion glob."					\
+	    " Use backslash to escape characters. Multiple -I "		\
+	    " arguments may be given. Exclusion globs are run in"	\
+	    " order along with exclusion globs (-X arguments) and"	\
+	    " legacy filtering globs (-f arguments) on a first-match"	\
+	    " basis."							\
+	)
+
+#define VSC_OPT_X							\
+	VOPT("X:", "[-X <glob>]", "Field exclusion glob",		\
+	    "Field exclusion glob."					\
+	    " Use backslash to escape characters. Multiple -X "		\
+	    " arguments may be given. Exclusion globs are run in"	\
+	    " order along with inclusion globs (-I arguments) and"	\
+	    " legacy filtering globs (-f arguments) on a first-match"	\
+	    " basis."							\
 	)


More information about the varnish-commit mailing list