logging LMTP activity

Aki Tuomi
Fri, 11 Sep 2020 17:49:48 -0000

> On 11/09/2020 20:30 Janis <dvml at abj.lv> wrote:
>
>
> Hello,
>
> I've been trying to set up Postfix + Dovecot LMTP setup. Basic idea
> taken from https://wiki2.dovecot.org/HowTo/PostfixDovecotLMTP, but since
> Postfix is on different host inet listener is used instead of unix socket.
>
> Message delivery works. Messages are delivered to correct mailboxes, if
> they exist.
>
> But the problem is with logging on Dovecot side; i can not get any lmtp
> logs at all. I kind of expected that i could get logs about:
> 1) Postfix has connected and delivering mail to mail at address.com,
> 2) If mailbox does not exists, would expect to see in logs the reason
> for rejection - mailbox does not exist
> 3) any other useful info would be nice as well.
>
> How do you get LMTP to log something? My Dovecot version is 2.3.11.3.
> Basic IMAP logging is working. I see when users have connected, etc.
>
> I tried as suggested at
> https://doc.dovecot.org/configuration_manual/protocols/lmtp_server/#logging
>
> If the given logging example block is used in configuration, i get no
> logs in file /var/log/dovecot-lmtp.log. I thought maybe file is not
> created automatically, so i tried to create it myself as well. Does not
> work. chmod 0777 does not either, chown to dovecot:dovecot neither.
>
> In a way i am curious about "executable = lmtp -L" part. What is
-L
> flag? Are there any more flags? Where could i learn about them? I have
> read all the docs that come with the buld and mention something of lmtp,
> it's basically wiki, i guess... but i could not find any helpful info.
>
> I found that file lmtp is at /usr/local/libexec/dovecot/lmtp. When i
> execute it with -L flag it works. Other flags don't. The problem is
that
> there are no -h or --help flags.
>
>
> Then i tried raw logging as described here:
>
https://doc.dovecot.org/admin_manual/debugging/debugging_rawlog/#debugging-rawlog
>
> As i understand, only 4th possibility is applicable to LMTP, am i right?
> 2nd kind of seems maybe somehow could be usable, but i don't see how...
>
> It is not clearly stated in wiki where "lmtp_rawlog_dir" should
be
> added, but i add it within "protocol lmtp { .. }" block, similar
as
> imap. Does not work for me - no logs while messages arrive.? The catchy
> part in wiki is that for imap special arguments are used "-R
rawlog" in
> service imap-login, postlogin.? But i don't see any lmtp-login or such
> service available. So should it work only with "lmtp_rawlog_dir"
option?
>
> What could i be doing wrong?
>
> Does anyone have working lmtp configuration with logging available?
>
> Thank you very much! I am sorry that my message is so long, but i tried
> even more to get it working... :)
>
> Any help or idea of how to better debug the situation or search for
> solution is kindly appreciated.

You could start with mail_debug=yes.

Aki