<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Em 06/06/2019 22:45, Aki Tuomi via
      dovecot escreveu:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1518395402.58354.1559871956285@appsuite-gw1.open-xchange.com">
      <blockquote type="cite">
        <div> map { </div>
        <div>     pattern = shared/last-login/$user/$domain </div>
        <div>     table = last_login </div>
        <div>     value_field = last_login </div>
        <div>     value_type = uint </div>
        <div> <br>
        </div>
        <div>     fields { </div>
        <div>         username = $user </div>
        <div>         domain = $domain </div>
        <div>        rip = $rip </div>
        <div>     } </div>
        <div> } </div>
      </blockquote>
      <div> <br>
      </div>
      <div> You are missing /$rip in pattern.  </div>
      <div class="io-ox-signature">
        <pre>---
Aki Tuomi</pre>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>Thanks Aki. <br>
    </p>
    <p>Works perfectly.</p>
    <p>What I did:</p>
    <p>#$ cat dovecot-last-login.conf</p>
    <p>connect = host=127.0.0.1 port=3306 dbname=vmail user=vmailadmin
      password=xxxxxxxxxxxxxxx<br>
    </p>
    <p>map {<br>
          pattern = shared/last-login/$user/$domain/$rip/$service<br>
          table = last_login<br>
          value_field = last_login<br>
          value_type = uint<br>
      <br>
          fields {<br>
              username = $user<br>
              domain = $domain<br>
              rip = $rip<br>
              proto = $service<br>
          }<br>
      }<br>
    </p>
    <p>------------------------------------------------------</p>
    <p>dovecot.conf:</p>
    <p>plugin {</p>
    <p>...</p>
    <p>...</p>
    <p>    # Track last login time on imap and pop3<br>
          last_login_dict = proxy::lastlogin<br>
          last_login_key = last-login/%u/%d/%r/%s<br>
      }<br>
    </p>
    <p>Result on mysql:</p>
    <p>mysql> select * from last_login where username =
      '<a class="moz-txt-link-abbreviated" href="mailto:julio@xxx.com.br">julio@xxx.com.br</a>';<br>
+------------------+------------+------------+---------------+-------+<br>
      | username         | domain     | last_login | rip           |
      proto |<br>
+------------------+------------+------------+---------------+-------+<br>
      | <a class="moz-txt-link-abbreviated" href="mailto:julio@xxx.com.br">julio@xxx.com.br</a> | xxx.com.br | 1559921589 | 177.xxx.xxx.230 |
      imap  |<br>
+------------------+------------+------------+---------------+-------+<br>
      1 row in set (0.00 sec)</p>
    <p><br>
    </p>
    <p>Thank you very much!!<br>
      <br>
    </p>
    <pre class="moz-signature" cols="72">----------------------------------
    _    Engº Julio Cesar Covolato
   0v0   <a class="moz-txt-link-rfc2396E" href="mailto:julio@psi.com.br"><julio@psi.com.br></a>
  /(_)\  F: +55 11 99175-9260
   ^ ^   PSI INTERNET
----------------------------------</pre>
  <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br /> <table style="border-top: 1px solid #D3D4DE;">
        <tr>
      <td style="width: 55px; padding-top: 18px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
                <td style="width: 470px; padding-top: 17px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Livre de vírus. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>.                 </td>
        </tr>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>