> > Here's the graph of our spam vs non-spam. Spam levels have > definitely > > dropped noticeably, though not precipitously. I've not > changed the SA > > or mail gateway config in a couple of weeks, so I don't think it's > > anything to do with changes I've made. > > I didn't include the graph you did, in case I get people complaining > about bandwith etc, but I would like to know what you used to generate > the graphs, more precisly, how did you accumilate the data, I > would like > to do a similar thing for our systems. Thanks in advance, if you can > help.
I set up some scripts to generate these graphs from amavisd-new. It is dependent on the log format of this program, so you'll need to adapt it if you don't use amavisd-new. I've attached an old post I made to the amavisd-new list about it back in May. johnS
--- Begin Message ---Hey all... I've spent a couple of days hacking together some perl scripts to generate spam statistics based on the spam_scan info in the later amavisd-new (thanks Mark!). They're ugly (I'm an admin, not a programmer, dammit!), but since I had to roll my own, I figured there might be others out there who were in need/want of such a utility. scan_spam.pl: Cat your /var/log/messages file(s) to it, and it generates a bunch of junk that is useful. The -t flag tells it to ignore all days but today (useful to run from cron at 11:59pm). It outputs a text file for each day in the format YYYY-MM-DD.txt with a tally (ready to send to gnuplot) of the number of emails that got each spam score (rounded to nearest integer). Also it appends to the allspam.txt and allham.txt files with the total number of spams and hams for each day, also in order to output to gnuplot (see below). It generates a file named "gnuplotscript" which it then sends to gnuplot to generate a .png (also can do .gif, whatever your flavour of gnuplot supports) with a graph like the example attached (see 2003-05-08.png). I run it from cron like this: # Parse logfiles and generate today's graph 59 23 * * * cd /home/groups/mis/spam; /home/johns/bin/scan_spam.pl -t < /var/log/messages scan_allspam.pl: This file parses the allspam.txt and allham.txt files and generates some intermediate files to then call gnuplot to generate a graph like allmail.gif. Gnuplot actually generates a .png file, which is then converted to a .gif with the Imagemagick "convert" program. The reason for this is that for some reason the .png file gnuplot was generating for me was unreadable. Looks fine when converted to .gif. Your mileage may vary. I call this from cron: # Take allspam.txt and allham.txt files and generate allmail.gif file 0 0 * * * cd /home/groups/mis/spam; /home/johns/bin/scan_allspam.pl Now, these are very ugly, and the whole "convert" thing is very much a hack, but hell, it seems to work. If you make any useful additions, please post it for everyone. Also, please don't yell and scream at me if these don't work for you. You'll probably want to be somewhat versed in perl to customize it for your site. Definitely check the pathnames in the scripts and update them as appropriate. Hopefully these are useful to someone! johns
scan_spam.pl
Description: Binary data
2003-05-08.png
Description: Binary data
scan_allspam.pl
Description: Binary data<<attachment: allmail.gif>>
--- End Message ---