PDA

View Full Version : e-mail stats



qwerty
10-22-2003, 11:27 AM
anyone running a slick stats package for their WH2 account to monitor mail traffic, etc?

FZ
10-23-2003, 11:13 AM
The only program I could find that does mail stats is AWStats (http://awstats.sourceforge.net). I have set it up successfully for my web stats, and I tried and tried for mail stats but could not get it working. You might have better luck. Anyway, what I do now for simple "stats" is use Procmail logging, and the "mailstat" program. What it does is tell me (via SSH, quite primitive) the total size and number of e-mails sent to each of my mail accounts, as well as display a grand total. Better than nothing, I suppose ;)

jalal
10-24-2003, 04:38 AM
Hey, awstats is a neat program.

Which part of it didn't work for you? I've just set it up on my main domain, I'll probably put it up on the other as well.

There is a fix needed in the maillogconvert.pl script, you can pick up a modified version at:
http://www.gnomedia.com/maillogconvert.pl.txt
and give that a try.

FZ
10-24-2003, 05:21 AM
Maillogconvert was the problem for me. It just wouldn't pick up anything in my /var/log/maillog properly. Its output was blank. I didn't look for any patches/fixes, though I did read something about this somewhere. I also read that they were included in the latest version (5.9 I think) which is the one I was using. So I just gave up... But I'd love to give it another go if you say it does work. Tried the URL you gave above, but I got a 404 :(

qwerty
10-24-2003, 10:03 AM
Anyway, what I do now for simple "stats" is use Procmail logging, and the "mailstat" program. What it does is tell me (via SSH, quite primitive) the total size and number of e-mails sent to each of my mail accounts, as well as display a grand total. Better than nothing, I suppos

Thanks for the info.

I was just looking for something simple, but not knowing to much about procmail, is this logging difficult to do/turn on. I am already using procmail to do some intercepting and deleting, so I have a little mileage on that odometer.

jalal
10-24-2003, 10:10 AM
hmm, didn't like the 'pl' in the filename.
Try this:
http://www.gnomedia.com/maillogconvert.txt
and rename the file to a .pl file

8)

FZ
10-27-2003, 11:07 AM
Hi qwerty

Sorry for the late reply, I've been really busy with some schoolwork.

Turning on logging is not difficult at all. All you need to do is add the following two lines to the bottom of your /etc/procmailrc file (make a backup of the original before you do this). If you are doing this via FTP, make sure to upload in ASCII mode, and then CHMOD the file 644.


LOGFILE=/var/log/procmail.log
LOGABSTRACT=YES

Then send yourself a test mail and make sure it comes through alright. After that, you can use the mailstat program (via SSH) to make sure that the above worked. Log in via SSH, type the following at the prompt and press enter:


mailstat -k /var/log/procmail.log

That should output some basic statistics on incoming mail (nothing on outgoing mail, unfortunately). If you have other Procmail recipes, you might need to add the two LOG... lines as above to those other files as well to make sure that everything is logged in one location.

When you try the mailstat command, it might say you need the "sort" program (happened to me). If this is the case, let me know and I will e-mail it to you (or upload to your anonymous FTP if you have one). This program was available on WestHost 1.0 servers, but for some reason was left on on 2.0 servers.

Lastly, if you get the above working, then you may want to add the following line to the end of your /.bashrc file:


alias emailstats='mailstat -k /var/log/procmail.log'

Replace emailstats with whatever you want to call this command. This will enable you to simply type "emailstats" at the prompt the next time you log in via SSH to view your stats. Also note that the -k is an option to output cumulative stats - the default behaviour (i.e. without the -k) is that it will output the stats and rename your procmail.log file to procmail.log.old so that the next time you check the stats, they are shown for e-mails that have arrived since you last checked. I hope that makes sense :oops:

FZ
10-27-2003, 01:30 PM
jalal,

Thanks a million. Using your version, I got it working. I have to say though, that it isn't nearly as "slick" (or intuitive) as the web stats it generates. I'm almost too afraid to say I actually prefer my mailstat -k /var/log/procmail.log :lol: I don't need stats on outgoing mail anyway. Thanks again. You should definitely leave up your version of maillogconvert for other WestHost AWStats users to use.

jalal
10-28-2003, 01:08 AM
Mailstat doesn't work on my installation ("Missing sort command"). Unfortunately, the sort command is hardcoded into mailstat, so I can't use the sort in /usr/local/bin

FZ
10-28-2003, 03:21 AM
...Unfortunately, the sort command is hardcoded into mailstat, so I can't use the sort in /usr/local/bin

That's not possible. I had the same problem, as I pointed out above. All I did was copy sort to /usr/bin (typing which sort now returns /usr/bin/sort) and it was working again. It's highly unlikely we are using different versions, so you might want to try this...

jalal
10-28-2003, 05:01 AM
Ah, yes... I didn't realize that I had write permissions to that directory... solved, thanks.

:)