Current time: 11-15-2024, 01:46 PM Hello There, Guest! (LoginRegister)


Thread Closed 
Imap accounting in dovecot
Author Message
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #1
Imap accounting in dovecot
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?
05-18-2010 12:06 AM
Find all posts by this user
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #2
RE: Imap accounting in dovecot
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
05-18-2010 09:59 PM
Visit this user's website Find all posts by this user
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #3
RE: Imap accounting in dovecot
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?
05-18-2010 11:43 PM
Find all posts by this user
Thread Closed 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)