Traffic accounting

Adi Pircalabu adi at ddns.com.au
Tue Jul 20 09:03:13 EEST 2021


On 20-07-2021 8:13, Jesús Ángel del Pozo Domínguez wrote:
> Hello,
> 
> Could you please tell me whether is it possible to do traffic
> accounting
> using Dovecot 2.3.4?
> 
> What I'd like to do is to collect network traffic (both in & out) for
> each user (both POP and IMAP traffic).
> 
> Regards,

It's possible, you need to adjust the IMAP & POP3 logging configuration, 
then parse the mail log and collect in/out values. E.g.:

doveconf -a | egrep '(imap|pop3).*logout_format'
imap_logout_format = rcvd=%i, sent=%o
imap_urlauth_logout_format = in=%i out=%o
pop3_logout_format = rcvd=%i, sent=%o, top=%t/%p, retr=%r/%b, del=%d/%m, 
size=%s

egrep 'dovecot: service=imap, user=user at domain.com.au.*Logged out' 
/var/log/maillog | tail -n 1
Jul 20 15:59:38 server dovecot: service=imap, user=user at domain.com.au, 
ip=[127.0.0.1]. Logged out rcvd=38, sent=593

YMMV

-- 
Adi Pircalabu


More information about the dovecot mailing list