2
** Copyright (C) 2009-2011 Softwink, Inc.
3
** Copyright (C) 2009-2011 Champ Clark III <champ@softwink.com>
5
** This program is free software; you can redistribute it and/or modify
6
** it under the terms of the GNU General Public License Version 2 as
7
** published by the Free Software Foundation. You may not use, modify or
8
** distribute this program under any other version of the GNU General
11
** This program is distributed in the hope that it will be useful,
12
** but WITHOUT ANY WARRANTY; without even the implied warranty of
13
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
** GNU General Public License for more details.
16
** You should have received a copy of the GNU General Public License
17
** along with this program; if not, write to the Free Software
18
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
* Simply dumps statistics of Sagan to the user or via sagan.log
28
#include "config.h" /* From autoconf */
39
struct _SaganConfig *config;
40
struct _SaganCounters *counters;
42
void sagan_statistics() {
48
sagan_log(0, "--------------------------------------------------------------------------");
49
sagan_log(0, "Total number of events processed: %" PRIu64 "", counters->sagantotal);
50
sagan_log(0, "Total number of events thresholded: %" PRIu64 " (%.3f%%)", counters->threshold_total, CalcPct( counters->threshold_total, counters->sagantotal) );
51
sagan_log(0, "Total number of signatures matched: %" PRIu64 " (%.3f%%)", counters->saganfound, CalcPct( counters->saganfound, counters->sagantotal ) );
52
sagan_log(0, "Total events dropped: %" PRIu64 " (%.3f%%)", counters->sagandrop, CalcPct(counters->sagandrop, counters->sagantotal) );
53
sagan_log(0, "--------------------------------------------------------------------------");
55
if ( config->sagan_ext_flag ) {
56
sagan_log(0, "Max external threads: %" PRIu64 " of %" PRIu64 " (%.3f%%) | External events dropped: %" PRIu64 "", counters->threadmaxextc, config->max_external_threads, CalcPct( counters->threadmaxextc, config->max_external_threads), counters->saganexternaldrop);
60
#if defined(HAVE_LIBMYSQLCLIENT_R) || defined(HAVE_LIBPQ)
62
if ( config->dbtype ) {
63
sagan_log(0, "Max Snort database threads: %" PRIu64 " of %" PRIu64 " (%.3f%%) | Snort DB drops: %" PRIu64 "", counters->threadmaxdbc, config->maxdb_threads, CalcPct( counters->threadmaxdbc, config->maxdb_threads), counters->sagansnortdrop);
67
if ( config->logzilla_dbtype ) {
68
sagan_log(0, "Max Logzilla threads: %" PRIu64 " of %" PRIu64 " (%.3f%%) | Logzilla events dropped: %" PRIu64 "", counters->threadmaxlogzillac, config->max_logzilla_threads, CalcPct( counters->threadmaxlogzillac, config->max_logzilla_threads), counters->saganlogzilladrop);
74
if ( config->sagan_esmtp_flag ) {
75
sagan_log(0, "Max SMTP threads reached: %" PRIu64 " of %" PRIu64 " (%.3f%%) | SMTP events dropped: %" PRIu64 "", counters->threadmaxemailc, config->max_email_threads, CalcPct( counters->threadmaxemailc, config->max_email_threads), counters->saganesmtpdrop);
80
#ifdef HAVE_LIBPRELUDE
81
if ( config->sagan_prelude_flag ) {
82
sagan_log(0, "Max Prelude threads reached: %" PRIu64 " of %" PRIu64 " (%.3f%%) | Prelude events dropped: %" PRIu64 "", counters->threadmaxpreludec, config->max_prelude_threads, CalcPct( counters->threadmaxpreludec, config->max_prelude_threads), counters->saganpreludedrop);
87
if ( flag == 1) sagan_log(0, "--------------------------------------------------------------------------");