ispCP - Board - Support
Imap accounting in dovecot - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: System Setup & Installation (/forum-32.html)
+--- Thread: Imap accounting in dovecot (/thread-10714.html)



Imap accounting in dovecot - aseques - 05-18-2010 12:06 AM

Hi, I am using dovecot, and I wanted to fix the imap traffic not being counted. Since dovecot 1.2 when you logout, the system register the in/out bytes of the session.
Can someone with similar setup try this script, it should output something like:
user=user@domain traffic


cat /var/log/ispcp/mail.log.prev |/bin/grep 'IMAP'|/bin/grep 'Logged out bytes'|awk '/IMAP/ {split($10,resul,"="); split(resul[2],oper,"/");print "user="substr($6,6,length($6)-7) , oper[1]+oper[2]}'


Can you verify it doesn't output extraneous data for you?


RE: Imap accounting in dovecot - BeNe - 05-18-2010 09:59 PM

Quote:I wanted to fix the imap traffic not being counted
This would be very fine. It is still a problem.
Looks good!
Code:
...
...
user=katta@a-nice-domain.tld 516
user=katta@a-nice-domain.tld 516
user=werner@a-better-domain.tld 513
user=werner@a-better-domain.tld 28111
user=werner@a-better-domain.tld 2090
user=werner@a-better-domain.tld 5162
user=werner@a-better-domain.tld 28
user=katta@a-nice-domain.tld 516
user=werner@a-better-domain.tld 484
user=katta@a-nice-domain.tld 516
user=werner@a-better-domain.tld 484
user=katta@a-nice-domain.tld 516
user=werner@a-better-domain.tld 507
user=werner@a-better-domain.tld 27947
user=werner@a-better-domain.tld 51
...
...

Greez BeNe


RE: Imap accounting in dovecot - aseques - 05-18-2010 11:43 PM

It seems to me that imap accounting is screwed on courier too:
Using this line as the log:
Code:
Aug 22 17:25:13 ascension imapd: TIMEOUT, user=gordon, ip=[::ffff:127.0.0.1], headers=0, body=0, rcvd=4770, sent=776926, time=3650
And parsing like ispcp:
Code:
/bin/cat /tmp/dom |/bin/grep 'imap'|/bin/grep 'user='|/bin/grep 'body='|/bin/grep -v 'ip=[::ffff:127.0.0.1]'|/usr/bin/awk '{print $7,$9,substr($10,1,length($10)-1);}'

It gives:
Code:
user=gordon, headers=0, body=0
Instead of 781696 wich would seem more reasonable (rvcd + sent bytes)

Does anyone have an explanation on what is the expected output?