On 6 June 2019 22:40 JĂșlio Covolato via dovecot < dovecot@dovecot.org> wrote:


Hi,

I'm configuring Last_Login plugin whith Mysql back end and all works fine.

I just wonder to track besides time_stamp, user and domain, the remote
IP and proto (imap or pop3)

I tried in dovecot.conf:

plugin {

...

...

    # Track last login time on imap and pop3
    last_login_dict = proxy::lastlogin
    last_login_key = last-login/%u/%d/%r

}

dict {
...

    lastlogin = mysql:/etc/dovecot/dovecot-last-login.conf
...
}

protocol imap {

    mail_plugins = $mail_plugins ... last_login
...

}

protocol pop3 {
    mail_plugins = $mail_plugins last_login

...

}

And dovecot-last-login.conf:

connect = host=127.0.0.1 port=3306 dbname=vmail user=vmailadmin
password=xxxxxxxxxxxxxxxxxx

map {
    pattern = shared/last-login/$user/$domain
    table = last_login
    value_field = last_login
    value_type = uint

    fields {
        username = $user
        domain = $domain
       rip = $rip
    }
}

You are missing /$rip in pattern. 
---
Aki Tuomi