#!/usr/bin/perl -w # $Id: graphdefang-config-mimedefang-example,v 1.2 2003/06/04 12:19:03 dfs Exp $ # # GraphDefang -- a set of tools to create graphs of your mimedefang # spam and virus logs. # # Written by: John Kirkland # jpk@bl.org # # Copyright (c) 2002-2003, John Kirkland # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #============================================================================= # # Path to incoming log file # $DATAFILE = '/var/log/mail.log'; # # Output directory for png files that are created # $OUTPUT_DIR = '/etc/graphdefang'; # Set graph settings # # Possible settings: # # Name: data_types (required) # Description: Array of events from the mimedefang log file to # graph. # Supported Values: These event names are not fixed. If you put an event # in mimedefang-filter with md_graphdefang_log('event'), then you # can use it here. The values used in the example # mimedefang-filter are 'spam', 'virus', # 'suspicious_chars', 'message/partial', 'bad_filename', # 'non_rfc822', 'non_multipart'. # 'all' is also supported, but it must be listed by itself. # # Name: graph_type (required) # Description: Type of graph to output. # Supported Values: 'line' or 'stacked_bar' # # Name: grouping (required) # Description: Which value to graph from the md_graphdefang_log file. # Supported Values: 'summary', 'value1', 'value2', 'sender', 'recipient' # 'subject'. value1 and value2 are the optional # parameters that can be logged with the md_graphdefang_log command # from mimedefang-filter. # # Name: grouping_times (required) # Description: Array of Time intervals to use for grouping # Supported Values: 'hourly', 'daily', or 'monthly' # # Name: top_n (optional) # Description: Limit number of values to the top n. This # value is recommended when looking at # senders, recipients, or subjects. # # Name: value1_title (optional) # Description: Title used in the header if value1 is # graphed. # # Name: value2_title (optional) # Description: Title used in the header if value2 is # graphed. # # Name: filter (optional) # Description: Regular expression filter that can be # used with value1, value2, sender, # recipient, and subject # Common uses: # '@westover.org' to filter sender or recipient by domain # '^(?:(?!klez).)*$' to filter OUT klez in a virusname # # Name: filter_name (optional) # Description: If a filter is used, the filtername will be appended # to the Graph Title as "filtered by $filter_name" and # appended to the end of the filename. # # Name: $GraphSettings{'title'} (optional) # Description: Assigns a title for the chart. # # Name: $GraphSettings{'filename'} (optional) # Description: Sets the filename for a given chart (note: # the grouping_time is appended to this variable # to determine the final file name. # # Name: $GraphSettings{'x_graph_size'} (optional) # Name: $GraphSettings{'y_graph_size'} (optional) # Description: Size, in pixels, for this graph. This overrides the # default. # # Name: $GraphSettings{'num_hourly_values'} (optional) # Name: $GraphSettings{'num_daily_values'} (optional) # Name: $GraphSettings{'num_monthly_values'} (optional) # Description: Number of data points for this graph. This overrides # the default. my %GraphSettings; #------------------------------------------------------------- %GraphSettings = (); %GraphSettings = ( 'data_types' => ['spam', 'probable_spam', 'virus', 'mail_in'], 'graph_type' => 'line', 'grouping' => 'summary', 'grouping_times'=> ['hourly','daily','monthly'], ); push @GRAPHS, { %GraphSettings }; #------------------------------------------------------------- %GraphSettings = (); %GraphSettings = ( 'data_types' => ['virus'], 'graph_type' => 'stacked_bar', 'grouping' => 'value1', 'value1_title' => 'VirusName', 'grouping_times'=> ['hourly','daily','monthly'], #'filter' => '^(?:(?!klez).)*$', #'filter_name' => 'Not Klez', ); push @GRAPHS, { %GraphSettings }; #------------------------------------------------------------- %GraphSettings = (); %GraphSettings = ( 'data_types' => ['spam'], 'graph_type' => 'stacked_bar', 'grouping' => 'recipient', 'top_n' => '9', 'grouping_times'=> ['hourly','daily','monthly'], 'filter' => '^(?:(?!westover.org).)*$', 'filter_name' => 'Heartlight Traffic', 'title' => 'Heartlight Spam Traffic', ); push @GRAPHS, { %GraphSettings }; #------------------------------------------------------------- %GraphSettings = (); %GraphSettings = ( 'data_types' => ['spam', 'virus'], 'graph_type' => 'stacked_bar', 'grouping' => 'recipient', 'top_n' => '9', 'grouping_times'=> ['hourly','daily','monthly'], ); push @GRAPHS, { %GraphSettings }; #------------------------------------------------------------- %GraphSettings = (); %GraphSettings = ( 'data_types' => ['spam'], 'graph_type' => 'stacked_bar', 'grouping' => 'sender', 'top_n' => '9', 'grouping_times'=> ['hourly','daily','monthly'], ); push @GRAPHS, { %GraphSettings }; #------------------------------------------------------------- %GraphSettings = (); %GraphSettings = ( 'data_types' => ['spam'], 'graph_type' => 'stacked_bar', 'grouping' => 'value2', 'value2_title' => 'Relay Address', 'top_n' => '9', 'grouping_times'=> ['hourly','daily','monthly'], ); push @GRAPHS, { %GraphSettings }; #------------------------------------------------------------- %GraphSettings = (); %GraphSettings = ( 'data_types' => ['virus'], 'graph_type' => 'stacked_bar', 'grouping' => 'value2', 'value2_title' => 'Relay Address', 'top_n' => '9', 'grouping_times'=> ['hourly','daily','monthly'], ); push @GRAPHS, { %GraphSettings };