From: Willy Tarreau Date: Sat, 16 Feb 2013 22:49:04 +0000 (+0100) Subject: MEDIUM: halog: add support for counting per source address (-ic) X-Git-Tag: v1.5-dev18~87 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7cf479cc09d4e4d142e8862e2a2792385f695439;p=thirdparty%2Fhaproxy.git MEDIUM: halog: add support for counting per source address (-ic) This is the same as -uc except that instead of counting URLs, it counts source addresses. The reported times are request times and not response times. The code becomes heavily ugly, the url struct is being abused to store an address, and there are no more bit fields available. The code needs a major revamp. --- diff --git a/contrib/halog/halog.c b/contrib/halog/halog.c index 61034eca2c..95529983a8 100644 --- a/contrib/halog/halog.c +++ b/contrib/halog/halog.c @@ -114,6 +114,7 @@ struct url_stat { FILT_COUNT_URL_BAVG|FILT_COUNT_URL_BTOT) #define FILT_COUNT_COOK_CODES 0x40000000 +#define FILT_COUNT_IP_COUNT 0x80000000 unsigned int filter = 0; unsigned int filter_invert = 0; @@ -126,6 +127,7 @@ int lines_max = -1; const char *fgets2(FILE *stream); void filter_count_url(const char *accept_field, const char *time_field, struct timer **tptr); +void filter_count_ip(const char *source_field, const char *accept_field, const char *time_field, struct timer **tptr); void filter_count_srv_status(const char *accept_field, const char *time_field, struct timer **tptr); void filter_count_cook_codes(const char *accept_field, const char *time_field, struct timer **tptr); void filter_count_term_codes(const char *accept_field, const char *time_field, struct timer **tptr); @@ -140,7 +142,7 @@ void usage(FILE *output, const char *msg) "%s" "Usage: halog [-h|--help] for long help\n" " halog [-q] [-c] [-m ]\n" - " {-cc|-gt|-pct|-st|-tc|-srv|-u|-uc|-ue|-ua|-ut|-uao|-uto|-uba|-ubt}\n" + " {-cc|-gt|-pct|-st|-tc|-srv|-u|-uc|-ue|-ua|-ut|-uao|-uto|-uba|-ubt|-ic}\n" " [-s ] [-e|-E] [-H] [-rt|-RT