OK, so I started playing with this. I'm running dovecot 2.3.7 on this server
(Ubuntu 20.04 LTS), so when I created a conf.d/95-plugins.conf file with the
content below, it wasn't happy about the metric stanza. However I dug
around in the documentation and found another few metrics to get going with that
my older version was happy with. I left it overnight.
When I came back in the morning, doveadm stats dump gave me ... a big line of
zeros! Oh.
Looking around further, I found that I needed to enable the mail_plugins
variable, both in the main config, and also under the imap and pop protocols. So
that looked like this:
# In 10-master.conf
mail_plugins = stats
# In 20-imap.conf
protocol imap {
#mail_plugins = quota imap_quota
mail_plugins = $mail_plugins quota imap_quota
}
So now a config dump gives
protocol imap {
mail_plugins = stats quota imap_quota
... and then the same edit in 20-pop.conf
Right. Restarted the server, all looking good, but now 'doveadm stats
dump' gives me
Fatal: Plugin 'stats' not found from directory /usr/lib/dovecot/modules
And sure enough, the stats plugin isn't there. And systemctl status dovecot
shows there is no stats daemon running.
Now the strange bit. I can't apt install dovecot-stats, because there
doesn't seem to be a dovecot-stats package available for Ubuntu!
Not sure how to proceed here. Will start looking for another repo, but at this
point, I've already spend a few hours hacking around. I could have knocked
up some log processing bash script in half that time! Isn't that always the
way ...
P.
On 24/05/2021 15.52, Aki Tuomi wrote:>
>> On 24/05/2021 10:20 Plutocrat <plutocrat at gmail.com> wrote:
>>
>>
>> Hi all,
>>
>> I run logwatch on a few servers and the script on there which parses
the dovecot logs provides waaaaaay too much detail, and contains a bunch of
stuff I'm not interested in. There's not much point in having a log
summary if its 100Kb long! The one for exim is also terrible, but I've
replaced that with eximstats, and a bit of bash scripting and have something I
can work with. I might at some point look at replacing that too.
>>
>> Now to my question. I haven't found anything in the dovecot family
which compares to eximstats. I was wondering if there possibly is a report tool,
or a way of extracting stats from doveadm just for key metrics such as
'number of POP logins in the last 24 hours', number of failed passwords,
etc. Things that might be interesting on a logwatch report. Or maybe someone has
written a script already that can be used in logwatch in perl, python, bash,
whatever. Any pointers, suggestions, or ideas for useful summary metrics to pull
out of the logfiles are appreciated.
>>
>> I suspect I might end up writing one myself anyway, but I'm just
keen to see what already exists, get the benefit of anyone else's
experiences in this matter before I start.
>>
>> P.
>
> with recent 2.3.14
>
> metric auth_failed {
> filter=event=auth_request_finished and (not success=yes)
> group_by = service
> }
>
> service stats {
> inet_listener http {
> port = 9900
> }
> }
>
> should produce
>
> auth_failed_pop3 etc. which you can collect with prometheus, or you can use
`doveadm stats dump`
>
> Aki
>