Two changes are needed to have dovecot update lastlog when a user logins with either imap or pop3.
In /etc/dovecot/cond.d/auth-system.conf.ext
enable PAM sessions
passdb {
driver = pam
args = session=yes dovecot
Then, enable the lastlog module in the dovecot PAM configuration at /etc/pam.d …