From: Tim Duesterhus Date: Wed, 15 Jul 2026 15:14:00 +0000 (+0200) Subject: MINOR: halog: Add support filtering on header capture values using -hdr-match X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60d69aacea108a302a5f85433273e4ded7da5659;p=thirdparty%2Fhaproxy.git MINOR: halog: Add support filtering on header capture values using -hdr-match This patch extends the existing support for printing captured header fields (`-hdr`) by a new filter (`-hdr-match`) that only processes lines where the given capture has a specific value. It works together with all existing filters and output formats. The full syntax is `-hdr-match :=`, where and work just like `-hdr` and `` is an exact string match: Example: capture request header a len 50 capture request header b len 50 capture request header c len 50 capture response header d len 50 capture response header e len 50 capture response header f len 50 - `-hdr-match 1:1=foo` will filter for requests where `a` is equal to "foo". - `-hdr-match "2:3=foo bar"` will filter for requests where `f` is equal to "foo bar". The chosen syntax leaves future scope for allowing `:*` for substring matches and `:^` for prefix matches without introducing a breaking change. --- diff --git a/admin/halog/halog.c b/admin/halog/halog.c index eaa808c43..2e9279b39 100644 --- a/admin/halog/halog.c +++ b/admin/halog/halog.c @@ -124,6 +124,7 @@ struct url_stat { #define FILT2_TIMESTAMP 0x01 #define FILT2_PRESERVE_QUERY 0x02 #define FILT2_CAPTURE_PRINT 0x04 +#define FILT2_CAPTURE_MATCH 0x08 #define FILT_OUTPUT_FMT (FILT_COUNT_ONLY| \ FILT_COUNT_STATUS| \ @@ -173,6 +174,7 @@ void usage(FILE *output, const char *msg) " halog [input_filters]* [modifiers]* [output_format] < log\n" " inp = [-e|-E] [-H] [-Q|-QS] [-rt|-RT