current config as below:

userdb {
  driver = prefetch
}
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
plugin {
  quota = maildir:User quota
    last_login_dict = proxy::lastlogin
    last_login_key = last-login/%u/%d/%r/%l/%a
    quota_status_success = DUNNO
    quota_status_nouser = DUNNO
    quota_status_overquota = "552 5.2.2 Mailbox is full"
}

###
If I changed as below no help,still no pass the Variable to last_login
userdb {
  driver = prefetch
}
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
userdb {
  driver = static
  args = last_login_key=last-login/%u/%d/%r/%l/%a
}

###
If I changed as below will trouble ,cannot restart dovecot
userdb {
  driver = prefetch
}
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext last_login_key=last-login/%u/%d/%r/%l/%a
  driver = sql
}






Aki Tuomi (<aki.tuomi@open-xchange.com>) 在 2021年2月28日星期日 下午03:56:09 [GMT+8] 寫道:


It goes into the arguments section...

Not having your config, I have to guess, but e.g.

userdb {
  driver = static
  args = last_login_key=last-login/%u/%d/%r/%l/%a
}

And similarly with other drivers, depending what you use.

Aki

> On 28/02/2021 09:53 Henry <hl1723@yahoo.com.hk> wrote:
>
>
>
> Dear Aka,
>
> If in userdb, set
>
> last_login_key=last-login/%u/%d/%r/%l/%a
>
> then cannot restart dovecot the error below :
>
> master: Error: Error reading configuration: Error in configuration file /etc/dovecot/dovecot.conf line 45: Unknown setting: userdb { last_login_key
>
> #
> If in userdb, set
> default_fields = last_login_key = last-login/%u/%d/%r/%l/%a
> Error:
> auth: Fatal: Invalid userdb template last_login_key = last-login/%u/%d/%r/%l/%a - key must not be empty
>
>
> what is my wrongs about? thanks
>
>
> Aki Tuomi (<aki.tuomi@open-xchange.com>) 在 2021年2月28日星期日 下午02:56:51 [GMT+8] 寫道:
>
>
> In your userdb, set
>
> last_login_key=last-login/%u/%d/%r/%l/%a
>
> Then it will expand into what you want, and will be imported into user's environment.
>
> Aki
>
>
> > On 28/02/2021 05:57 Henry <hl1723@yahoo.com.hk> wrote:
> >
> >
> > like capture local_port, I using %a will got below error
> >
> > Error: Failed to expand plugin setting last_login_key = 'last-login/%u/%d/%r/%l/%a': Unknown variable '%a'
> >
> >
> > If I using any of $local_port ,'$local_port', "$local_port", `$local_port`
> >
> > I got the database update as $local_port ,'$local_port', "$local_port", `$local_port` at the field column record.
> >
> >
> >
> > Henry (<hl1723@yahoo.com.hk>) 在 2021年2月27日星期六 下午10:57:27 [GMT+8] 寫道:
> >
> >
> > I already try using other variables , I found it only support "Mail service user variables", no support "Login variables" and "Authentication variables"
> >
> > below the error when I try to using "Login variables" and "Authentication variables"
> >
> > Error: Failed to expand plugin setting last_login_key = 'last-login/%u/%d/%r/%l/%k': Unknown variable '%k'
> > Error: Failed to expand plugin setting last_login_key = 'last-login/%u/%d/%r/%l/%b': Unknown variable '%b'
> > Error: Failed to expand plugin setting last_login_key = 'last-login/%u/%d/%r/%l/%m': Unknown variable '%m'
> >
> > I using centos 8 and dovecot-2.3.13-2.x86_64,
> >
> >
> > thanks
> >
> > Aki Tuomi (<aki.tuomi@open-xchange.com>) 在 2021年2月27日星期六 下午07:32:38 [GMT+8] 寫道:
> >
> >
> > last_login supports some of the variables.
> >
> >
> > Mail service and mail user variables are supported.
> >
> > You can try export the auth variables as userdb variables and use $variablename.
> >
> > Aki
> >
> >
> > On 27 February 2021 7.29.10 EET, Henry <hl1723@yahoo.com.hk> wrote:
> > >
> > >Anyone know then last_login plugins do support standard auth variables
> > >in var-expand?like %k %a variables.
> > >I need logging other fields such as port 143 or 993, and tls 1.1 or tls
> > >1.3, client hostname,
> > >any patch for this? thanks
> > >
> > >https://doc.dovecot.org/configuration_manual/config_file/config_variables/
> > > Henry (<hl1723@yahoo.com.hk>) 在 2021年2月19日星期五 下午12:15:10 [GMT+8] 寫道:
> > >
> > >but I need logging other fields such as port 143 or 993, and tls 1.1 or
> > >tls 1.3, client hostname, what should I do it ?
> > >https://doc.dovecot.org/configuration_manual/config_file/config_variables/
> > >
> > >Aki Tuomi (<aki.tuomi@open-xchange.com>) 在 2021年2月18日星期四 下午03:04:10
> > >[GMT+8] 寫道:
> > >
> > >
> > >> On 18/02/2021 08:57 Henry <hl1723@yahoo.com.hk> wrote:
> > >>
> > >>
> > >>
> > >>
> > >> Anyone kwon the last-login plugins can using Authentication variables
> > >such as %m mechanism, %a local_port .
> > >> we want to record this in DB, thanks
> > >
> > >You can use this syntax to add further fields for last_login plugin.
> > >
> > > map {
> > > pattern = shared/last-login/$user/$domain
> > > table = last_login
> > > value_field = last_login
> > > value_type = uint
> > >
> > > fields {
> > > username = $user
> > > domain = $domain
> > > rip = $rip
> > > }
> > >}
> > >
> > >Aki
> >
> > >
> >
> > --
> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
> >