Aki Tuomi
2022-May-12 05:30 UTC
How to use mail_user_session_finished? (was Re: [Dovecot-news] Dovecot v2.3.19 released)
> On 12/05/2022 01:15 Sylvain Robitaille <sag at encs.concordia.ca> wrote: > > > On Tue, 10 May 2022, Aki Tuomi via Dovecot-news wrote: > > > + Added mail_user_session_finished event, which is emitted when the mail > > user session is finished (e.g. imap, pop3, lmtp). It also includes > > fields with some process statistics information. > > See https://doc.dovecot.org/admin_manual/list_of_events/ for more > > information. > > We thought that this might give us some useful information in our logs, > especially when investigating user complaints (thanks, by the way, both > for Dovecot itself, and for the new logging functionality). I added to > our 10-logging.conf file: > > --- .../10-logging.conf 2022-02-02 09:53:52.000000000 -0500 > +++ .../10-logging.conf 2022-05-11 16:40:48.116914000 -0400 > @@ -44,8 +44,13 @@ plugin { > #mail_log_events = delete undelete expunge copy mailbox_delete > mailbox_rename > #mail_log_events = mailbox_delete mailbox_rename > # 2022-01-02 Anne Bennett: per RT#461889, log more > - mail_log_events = delete undelete expunge copy mailbox_delete > mailbox_rename append flag_change > + # 2022-05-11 Sylvain Robitaille: per RT#478860, log new > + # mail_user_session_finished event > + mail_log_events = delete undelete expunge copy mailbox_delete > mailbox_rename append flag_change mail_user_session_finished > # Available fields: uid, box, msgid, from, subject, size, vsize, flags > # size and vsize are available only for expunge and copy events. > - mail_log_fields = uid box msgid size > + # mail_user_session_finished adds: utime, stime, minor_faults, > + # major_faults, vol_cs, invol_cs, rss, vsz, rchar, wchar, syscr, > + # syscw > + mail_log_fields = uid box msgid size rss vsz > } > > ... and reloaded ("dovecot reload"), following which the log > informed me: > > May 11 16:56:45 lust dovecot: master: Warning: SIGHUP received - reloading configuration > May 11 16:56:46 lust dovecot: imap(syl)<27995><X6CKJb/eMpSEzQLZ>: Disconnected: Server shutting down. in=20441 out=1721757 deleted=42 > expunged=40 trashed=0 hdr_count=89 hdr_bytes=147223 body_count=81 body_bytes=1504010 > ... > May 11 16:58:05 lust dovecot: imap-login: Login: user=<syl>, method=GSSAPI, rip=132.205.2.217, lip=132.205.96.89, mpid=26509, TLS, session=<td6lssLenKKEzQLZ> > May 11 16:58:05 lust dovecot: imap(syl)<26509><td6lssLenKKEzQLZ>: Fatal: Unknown field in mail_log_fields: 'rss' > > Hrmmm ... Ok, remove "rss" and reload: > > May 11 16:58:44 lust dovecot: master: Warning: SIGHUP received - reloading configuration > May 11 16:58:50 lust dovecot: imap-login: Login: user=<syl>, method=GSSAPI, rip=132.205.2.217, lip=132.205.96.89, mpid=26573, TLS, session=<e/hRtcLepKKEzQLZ> > May 11 16:58:50 lust dovecot: imap(syl)<26573><e/hRtcLepKKEzQLZ>: Fatal: Unknown field in mail_log_fields: 'vsz' > > Not what I was expecting, of course, but can we at least see the > events logged? remove "vsz" and reload again: > > May 11 16:59:02 lust dovecot: master: Warning: SIGHUP received - reloading configuration > May 11 16:59:06 lust dovecot: imap-login: Login: user=<syl>, method=GSSAPI, rip=132.205.2.217, lip=132.205.96.89, mpid=26606, TLS, session=<BuVBtsLepqKEzQLZ> > May 11 16:59:06 lust dovecot: imap(syl)<26606><BuVBtsLepqKEzQLZ>: Fatal: Unknown event in mail_log_events: 'mail_user_session_finished' > > Alright, remove mail_user_session_finished and reload, and it's ok > again. I *must* be doing something wrong here, but I can't figure > out what that it, and it seems that mail_user_session_finished has not > reached any of the documentation within the source tree. Can someone > point me to documentation for how to use this? Am I jumping the gun > here, or am I just doing it wrong? > > -- > ---------------------------------------------------------------------- > Sylvain Robitaille syl at encs.concordia.ca >Hi! Can you provide us with the configuration you attempted? AKi
Sylvain Robitaille
2022-May-12 13:10 UTC
[SAG] How to use mail_user_session_finished? (was Re: [Dovecot-news] Dovecot v2.3.19 released)
On Thu, 12 May 2022, Aki Tuomi wrote:> Can you provide us with the configuration you attempted?Sure, but the complete configuration is spread across a number of files: ... ??? encs.d ??? ??? 10-auth.conf ??? ??? 10-logging.conf ??? ??? 10-mail.conf ??? ??? 10-master.conf ??? ??? 10-ssl.conf ??? ??? 20-imap.conf ??? ??? 20-lmtp.conf ??? ??? 20-managesieve.conf ??? ??? 20-submission.conf ??? ??? 90-sieve.conf ??? ??? auth-ldap.conf ??? ??? ldap.EXTRA ... Is that what you want, or are you interested specifically in the logging configuration? The complete configuration as it is works fine, and what I'd done was simply to add to the logging configuration so it from from this: # mail_log plugin provides more event logging for mail processes. plugin { # Events to log. Also available: flag_change append #mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename #mail_log_events = mailbox_delete mailbox_rename # 2022-01-02 Anne Bennett: per RT#461889, log more mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename append flag_change # Available fields: uid, box, msgid, from, subject, size, vsize, flags # size and vsize are available only for expunge and copy events. mail_log_fields = uid box msgid size } ... to this: # mail_log plugin provides more event logging for mail processes. plugin { # Events to log. Also available: flag_change append #mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename #mail_log_events = mailbox_delete mailbox_rename # 2022-01-02 Anne Bennett: per RT#461889, log more # 2022-05-11 Sylvain Robitaille: per RT#478860, log new # mail_user_session_finished event mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename append flag_change mail_user_session_finished # Available fields: uid, box, msgid, from, subject, size, vsize, flags # size and vsize are available only for expunge and copy events. # mail_user_session_finished adds: utime, stime, minor_faults, # major_faults, vol_cs, invol_cs, rss, vsz, rchar, wchar, syscr, # syscw mail_log_fields = uid box msgid size rss vsz } Everything else was left as is from the existing, working configuration. I can tar up the entire configuration if you really want to see it all, or you could tell me if there are specific items you're specifically looking for. -- ---------------------------------------------------------------------- Sylvain Robitaille syl at encs.concordia.ca Systems analyst / AITS Concordia University Faculty of Engineering and Computer Science Montreal, Quebec, Canada ----------------------------------------------------------------------
Aki Tuomi
2022-May-12 13:48 UTC
[EXT] Re: [SAG] How to use mail_user_session_finished? (was Re: [Dovecot-news] Dovecot v2.3.19 released)
> On 12/05/2022 16:10 Sylvain Robitaille <sag at encs.concordia.ca> wrote: > > > On Thu, 12 May 2022, Aki Tuomi wrote: > > > Can you provide us with the configuration you attempted? > > Sure, but the complete configuration is spread across a number of files:<snip/> If we read the documentation, we learn that the mail_user_session_finished is an event. To export events, we use https://doc.dovecot.org/configuration_manual/event_export/ so. event_exporter log { format = json format_args = time-rfc3339 transport = log } metric mail_user_session { filter = event=mail_user_session_finished exporter = log } p.s. you can use `doveconf -n` to get single output of your spread configuration. Regards, Aki