From c6346470f9246c7006d0ac17a18ef5b7e8f44385 Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sun, 11 May 2025 14:32:09 +0200 Subject: [PATCH] Add sums per month to HostStats. Signed-off-by: Thomas Hochstein --- bin/cliservstats.pl | 7 +++++++ bin/gatherstats.pl | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/cliservstats.pl b/bin/cliservstats.pl index 6d76779..5f9b3f4 100644 --- a/bin/cliservstats.pl +++ b/bin/cliservstats.pl @@ -107,7 +107,9 @@ if ($OptNames) { } ### build SQL WHERE clause +my $ExcludeSums = $OptSums ? '' : sprintf("%s != 'ALL'",$OptType); my $SQLWhereClause = SQLBuildClause('where',$SQLWherePeriod,$SQLWhereNames, + $ExcludeSums, &SQLSetBounds('default',$LowBound,$UppBound)); ### get sort order and build SQL 'ORDER BY' clause @@ -304,6 +306,11 @@ example eternal-september.org:solani.org:*.inka.de +=item B<-s>, B<--sums|--nosums> (sum per month) + +Include a "virtual" host named "ALL" for every month in output, +containing the sum of all detected hosts for that month. + =item B<-r>, B<--report> I Choose the report type: I or I diff --git a/bin/gatherstats.pl b/bin/gatherstats.pl index 83f2ee9..1dc5b78 100755 --- a/bin/gatherstats.pl +++ b/bin/gatherstats.pl @@ -350,6 +350,7 @@ sub HostStats { # count host if ($Host) { $Postings{$Host}++; + $Postings{'ALL'}++; } else { &Bleat(2,sprintf("%s FAILED", $Header{'message-id'})) if !$Host; } @@ -438,7 +439,7 @@ override that default through the B<--groupsdb> option. B will examine Injection-Info:, X-Trace: and Path: headers and try to normalize them. Groups not in I will be -ignored. +ignored. The sum of all detected hosts will also saved for each month. Data is written to I (see L); you can override that default through the B<--hostsdb> option.