<html><head></head><body><div class="ydp3fb2ea29yahoo-style-wrap" style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 13px;"><div></div>
<div dir="ltr" data-setdir="false"><div><div dir="ltr" data-setdir="false">Dear Aka</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Still no luck, same error</div><div dir="ltr" data-setdir="false">Error: Failed to expand plugin setting last_login_key = 'last-login/%u/%d/%r/%l/%a': Unknown variable '%a'<br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">If I remark <span><span style="color: rgb(0, 0, 0); font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"> #last_login_key = last-login/%u/%d/%r/%l/%a at <span><span style="color: rgb(0, 0, 0); font-family: Helvetica Neue, Helvetica, Arial, sans-serif;">plugin , error as below</span></span></span></span></div><div dir="ltr" data-setdir="false">Error: last_login_dict: Failed to write value: dict-server returned failure: sql dict set: Invalid/unmapped key: shared/last-login/<br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">#dovecot.conf</div><div dir="ltr" data-setdir="false">userdb {<br></div><div dir="ltr" data-setdir="false"><div> driver = prefetch</div><div>}</div><div>userdb {</div><div> args = /etc/dovecot/dovecot-sql.conf.ext</div><div> driver = sql</div><div>}</div><div>plugin {<br></div><div> quota = maildir:User quota<br></div><div> last_login_dict = proxy::lastlogin<br></div><div> last_login_key = last-login/%u/%d/%r/%l/%a</div><div> quota_status_success = DUNNO<br></div><div> quota_status_nouser = DUNNO</div><div> quota_status_overquota = "552 5.2.2 Mailbox is full"</div><div>}</div><div dir="ltr" data-setdir="false"><div><div>dict {</div><div> lastlogin = mysql:/etc/dovecot/dovecot-last-login.conf<br></div><div>}</div><div><br></div></div></div></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"># <span><span style="color: rgb(0, 0, 0); font-family: Helvetica Neue, Helvetica, Arial, sans-serif;">dovecot-sql.conf.ext</span></span></div><div>password_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user,pw_passwd AS password, concat('*:backend=', pw_shell) as \<br></div><div>userdb_quota_rule, 89 AS userdb_uid, 89 AS userdb_gid, pw_dir AS userdb_home ,'last-login/%u/%d/%r/%l/%a' AS last_login_key FROM vpopmail LEFT JOIN limits ON vpopmail.pw_domain = \</div><div>limits.domain WHERE pw_name = '%n' AND pw_domain='%d' AND (( '%s' = 'smtp' AND (pw_gid & 2048)<>2048 AND COALESCE(disable_smtp,0)!=1) OR \</div><div>('%s' = 'pop3' AND (pw_gid & 2)<>2 AND COALESCE(disable_pop,0) != 1 ) OR ('%s' = 'imap' AND ('%r'='127.0.0.1') AND \</div><div>(pw_gid & 4)<>4 AND COALESCE(disable_webmail,0)!=1) OR ('%s' = 'imap' AND ('%r'!='127.0.0.1') AND (pw_gid & 8)<>8 AND COALESCE(disable_imap,0)!=1));</div><div><br></div><div>user_query = \<br></div><div> SELECT pw_dir AS home, \</div><div> 89 AS uid, \</div><div> 89 AS gid, \</div><div> CONCAT('*:bytes=', REPLACE(SUBSTRING_INDEX(pw_shell, 'S', 1), 'NOQUOTA', '0')) AS quota_rule, \</div><div> 'last-login/%u/%d/%r/%l/%a' AS last_login_key \</div><div> FROM vpopmail \</div><div> WHERE pw_name = '%n' AND pw_domain = '%d' \</div><div> AND ('%a'!='995' or !(pw_gid & 2)) \</div><div> AND ('%r'!='[WEBMAIL-IP]' or !(pw_gid & 4)) \</div><div> AND ('%r'='[WEBMAIL-IP]' or '%a'!='993' or !(pw_gid & 8))</div><div><br></div></div><br></div><div><br></div>
</div><div id="yahoo_quoted_5243056057" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
Aki Tuomi (<aki.tuomi@open-xchange.com>) 在 2021年2月28日星期日 下午04:55:04 [GMT+8] 寫道:
</div>
<div><br></div>
<div><br></div>
<div><div dir="ltr">You need to put it in the sql query. SELECT ..., 'last-login/%u/%d/%r/%l/%a' AS last_login_key<br clear="none"><br clear="none">Aki <br clear="none"><div class="yqt1992455784" id="yqtfd69321"><br clear="none">On February 28, 2021 8:12:39 AM UTC, Henry <<a shape="rect" ymailto="mailto:hl1723@yahoo.com.hk" href="mailto:hl1723@yahoo.com.hk">hl1723@yahoo.com.hk</a>> wrote:<br clear="none">> current config as below:<br clear="none">>userdb { driver = prefetch}userdb { args =<br clear="none">>/etc/dovecot/dovecot-sql.conf.ext driver = sql}plugin { quota =<br clear="none">>maildir:User quota<br clear="none">> last_login_dict = proxy::lastlogin<br clear="none">> last_login_key = last-login/%u/%d/%r/%l/%a quota_status_success<br clear="none">>= DUNNO<br clear="none">> quota_status_nouser = DUNNO quota_status_overquota = "552 5.2.2<br clear="none">>Mailbox is full"}<br clear="none">>###<br clear="none">>If I changed as below no help,still no pass the Variable to<br clear="none">>last_loginuserdb { driver = prefetch}userdb { args =<br clear="none">>/etc/dovecot/dovecot-sql.conf.ext driver = sql}userdb { driver =<br clear="none">>static args = last_login_key=last-login/%u/%d/%r/%l/%a}<br clear="none">>###If I changed as below will trouble ,cannot restart dovecotuserdb { <br clear="none">>driver = prefetch}userdb { args =<br clear="none">>/etc/dovecot/dovecot-sql.conf.ext last_login_key=last-login/%u/%d/%r/%l/%a <br clear="none">>driver = sql}<br clear="none">><br clear="none">><br clear="none">><br clear="none">><br clear="none">><br clear="none">>Aki Tuomi (<<a shape="rect" ymailto="mailto:aki.tuomi@open-xchange.com" href="mailto:aki.tuomi@open-xchange.com">aki.tuomi@open-xchange.com</a>>) 在 2021年2月28日星期日 下午03:56:09<br clear="none">>[GMT+8] 寫道: <br clear="none">> <br clear="none">> It goes into the arguments section...<br clear="none">><br clear="none">>Not having your config, I have to guess, but e.g.<br clear="none">><br clear="none">>userdb {<br clear="none">> driver = static<br clear="none">> args = last_login_key=last-login/%u/%d/%r/%l/%a<br clear="none">>}<br clear="none">><br clear="none">>And similarly with other drivers, depending what you use. <br clear="none">><br clear="none">>Aki<br clear="none">><br clear="none">>> On 28/02/2021 09:53 Henry <<a shape="rect" ymailto="mailto:hl1723@yahoo.com.hk" href="mailto:hl1723@yahoo.com.hk">hl1723@yahoo.com.hk</a>> wrote:<br clear="none">>> <br clear="none">>> <br clear="none">>> <br clear="none">>> Dear Aka,<br clear="none">>> <br clear="none">>> If in userdb, set<br clear="none">>> <br clear="none">>> last_login_key=last-login/%u/%d/%r/%l/%a<br clear="none">>> <br clear="none">>> then cannot restart dovecot the error below :<br clear="none">>> <br clear="none">>> master: Error: Error reading configuration: Error in configuration<br clear="none">>file /etc/dovecot/dovecot.conf line 45: Unknown setting: userdb {<br clear="none">>last_login_key<br clear="none">>> <br clear="none">>> #<br clear="none">>> If in userdb, set<br clear="none">>> default_fields = last_login_key = last-login/%u/%d/%r/%l/%a<br clear="none">>> Error:<br clear="none">>> auth: Fatal: Invalid userdb template last_login_key =<br clear="none">>last-login/%u/%d/%r/%l/%a - key must not be empty<br clear="none">>> <br clear="none">>> <br clear="none">>> what is my wrongs about? thanks<br clear="none">>> <br clear="none">>> <br clear="none">>> Aki Tuomi (<<a shape="rect" ymailto="mailto:aki.tuomi@open-xchange.com" href="mailto:aki.tuomi@open-xchange.com">aki.tuomi@open-xchange.com</a>>) 在 2021年2月28日星期日 下午02:56:51<br clear="none">>[GMT+8] 寫道:<br clear="none">>> <br clear="none">>> <br clear="none">>> In your userdb, set <br clear="none">>> <br clear="none">>> last_login_key=last-login/%u/%d/%r/%l/%a<br clear="none">>> <br clear="none">>> Then it will expand into what you want, and will be imported into<br clear="none">>user's environment.<br clear="none">>> <br clear="none">>> Aki<br clear="none">>> <br clear="none">>> <br clear="none">>> > On 28/02/2021 05:57 Henry <<a shape="rect" ymailto="mailto:hl1723@yahoo.com.hk" href="mailto:hl1723@yahoo.com.hk">hl1723@yahoo.com.hk</a>> wrote:<br clear="none">>> > <br clear="none">>> > <br clear="none">>> > like capture local_port, I using %a will got below error<br clear="none">>> > <br clear="none">>> > Error: Failed to expand plugin setting last_login_key =<br clear="none">>'last-login/%u/%d/%r/%l/%a': Unknown variable '%a'<br clear="none">>> > <br clear="none">>> > <br clear="none">>> > If I using any of $local_port ,'$local_port', "$local_port",<br clear="none">>`$local_port`<br clear="none">>> > <br clear="none">>> > I got the database update as $local_port ,'$local_port',<br clear="none">>"$local_port", `$local_port` at the field column record.<br clear="none">>> > <br clear="none">>> > <br clear="none">>> > <br clear="none">>> > Henry (<<a shape="rect" ymailto="mailto:hl1723@yahoo.com.hk" href="mailto:hl1723@yahoo.com.hk">hl1723@yahoo.com.hk</a>>) 在 2021年2月27日星期六 下午10:57:27 [GMT+8]<br clear="none">>寫道:<br clear="none">>> > <br clear="none">>> > <br clear="none">>> > I already try using other variables , I found it only support "Mail<br clear="none">>service user variables", no support "Login variables" and<br clear="none">>"Authentication variables"<br clear="none">>> > <br clear="none">>> > below the error when I try to using "Login variables" and<br clear="none">>"Authentication variables"<br clear="none">>> > <br clear="none">>> > Error: Failed to expand plugin setting last_login_key =<br clear="none">>'last-login/%u/%d/%r/%l/%k': Unknown variable '%k'<br clear="none">>> > Error: Failed to expand plugin setting last_login_key =<br clear="none">>'last-login/%u/%d/%r/%l/%b': Unknown variable '%b'<br clear="none">>> > Error: Failed to expand plugin setting last_login_key =<br clear="none">>'last-login/%u/%d/%r/%l/%m': Unknown variable '%m'<br clear="none">>> > <br clear="none">>> > I using centos 8 and dovecot-2.3.13-2.x86_64,<br clear="none">>> > <br clear="none">>> > <br clear="none">>> > thanks<br clear="none">>> > <br clear="none">>> > Aki Tuomi (<<a shape="rect" ymailto="mailto:aki.tuomi@open-xchange.com" href="mailto:aki.tuomi@open-xchange.com">aki.tuomi@open-xchange.com</a>>) 在 2021年2月27日星期六 下午07:32:38<br clear="none">>[GMT+8] 寫道:<br clear="none">>> > <br clear="none">>> > <br clear="none">>> > last_login supports some of the variables. <br clear="none">>> > <br clear="none">>> > <br clear="none">>> > Mail service and mail user variables are supported. <br clear="none">>> > <br clear="none">>> > You can try export the auth variables as userdb variables and use<br clear="none">>$variablename. <br clear="none">>> > <br clear="none">>> > Aki<br clear="none">>> > <br clear="none">>> > <br clear="none">>> > On 27 February 2021 7.29.10 EET, Henry <<a shape="rect" ymailto="mailto:hl1723@yahoo.com.hk" href="mailto:hl1723@yahoo.com.hk">hl1723@yahoo.com.hk</a>> wrote:<br clear="none">>> > > <br clear="none">>> > >Anyone know then last_login plugins do support standard auth<br clear="none">>variables<br clear="none">>> > >in var-expand?like %k %a variables.<br clear="none">>> > >I need logging other fields such as port 143 or 993, and tls 1.1<br clear="none">>or tls<br clear="none">>> > >1.3, client hostname,<br clear="none">>> > >any patch for this? thanks<br clear="none">>> > ><br clear="none">>> ><br clear="none">>><a shape="rect" href="https://doc.dovecot.org/configuration_manual/config_file/config_variables/" target="_blank">https://doc.dovecot.org/configuration_manual/config_file/config_variables/</a><br clear="none">>> > > Henry (<<a shape="rect" ymailto="mailto:hl1723@yahoo.com.hk" href="mailto:hl1723@yahoo.com.hk">hl1723@yahoo.com.hk</a>>) 在 2021年2月19日星期五 下午12:15:10 [GMT+8]<br clear="none">>寫道: <br clear="none">>> > > <br clear="none">>> > >but I need logging other fields such as port 143 or 993, and tls<br clear="none">>1.1 or<br clear="none">>> > >tls 1.3, client hostname, what should I do it ?<br clear="none">>> ><br clear="none">>><a shape="rect" href="https://doc.dovecot.org/configuration_manual/config_file/config_variables/" target="_blank">https://doc.dovecot.org/configuration_manual/config_file/config_variables/</a><br clear="none">>> > ><br clear="none">>> > >Aki Tuomi (<<a shape="rect" ymailto="mailto:aki.tuomi@open-xchange.com" href="mailto:aki.tuomi@open-xchange.com">aki.tuomi@open-xchange.com</a>>) 在 2021年2月18日星期四<br clear="none">>下午03:04:10<br clear="none">>> > >[GMT+8] 寫道: <br clear="none">>> > > <br clear="none">>> > > <br clear="none">>> > >> On 18/02/2021 08:57 Henry <<a shape="rect" ymailto="mailto:hl1723@yahoo.com.hk" href="mailto:hl1723@yahoo.com.hk">hl1723@yahoo.com.hk</a>> wrote:<br clear="none">>> > >> <br clear="none">>> > >> <br clear="none">>> > >> <br clear="none">>> > >> <br clear="none">>> > >> Anyone kwon the last-login plugins can using Authentication<br clear="none">>variables<br clear="none">>> > >such as %m mechanism, %a local_port .<br clear="none">>> > >> we want to record this in DB, thanks<br clear="none">>> > ><br clear="none">>> > >You can use this syntax to add further fields for last_login<br clear="none">>plugin.<br clear="none">>> > ><br clear="none">>> > > map {<br clear="none">>> > > pattern = shared/last-login/$user/$domain<br clear="none">>> > > table = last_login<br clear="none">>> > > value_field = last_login<br clear="none">>> > > value_type = uint<br clear="none">>> > ><br clear="none">>> > > fields {<br clear="none">>> > > username = $user<br clear="none">>> > > domain = $domain<br clear="none">>> > > rip = $rip<br clear="none">>> > > }<br clear="none">>> > >} <br clear="none">>> > ><br clear="none">>> > >Aki<br clear="none">>> > <br clear="none">>> > > <br clear="none">>> > <br clear="none">>> > -- <br clear="none">>> > Sent from my Android device with K-9 Mail. Please excuse my<br clear="none">>brevity.<br clear="none">>> ><br clear="none">> <br clear="none"></div></div></div>
</div>
</div></body></html>