[Dovecot] syslog with PID
Hi,
LOG_NDELAY is the only option for openlog() in dovecot 1.1.2. Wouldn't be LOG_NDELAY|LOG_PID as option parameter much more useful? Without logging the pid, it is impossible to match 'Disconnected' log entries and the corresponding session start/login. Therefore I suggest to use
LOG_NDELAY|LOG_PID
in the options of i_set_failure_syslog() at all 6 occurrences which passes it to openlog().
I know that it is possible to - use logging to file - patch it myself but I can't see good reasons in not using LOG_PID here. As far as I know, most other programs specify LOG_PID.
Without LOG_PID: Jul 31 10:21:08 name dovecot: IMAP(hsg): Disconnected: Logged out bytes=28/242
With LOG_PID: Jul 31 10:21:08 name dovecot[17016]: IMAP(hsg): Disconnected: Logged out bytes=28/242
Heiko
Heiko Schlichting Freie Universität Berlin heiko@FU-Berlin.DE Zentraleinrichtung für Datenverarbeitung (ZEDAT) Telefon +49 30 838-54327 Fabeckstraße 32 Telefax +49 30 838454327 14195 Berlin
I wrote:
LOG_NDELAY is the only option for openlog() in dovecot 1.1.2. Wouldn't be LOG_NDELAY|LOG_PID as option parameter much more useful?
Ok, ignore my question. As logging is always handled by the daemon, this does not provide additional information about the subprocesses at this time.
Sorry, Heiko
Heiko Schlichting Freie Universität Berlin heiko@FU-Berlin.DE Zentraleinrichtung für Datenverarbeitung (ZEDAT) Telefon +49 30 838-54327 Fabeckstraße 32 Telefax +49 30 838454327 14195 Berlin
On Jul 31, 2008, at 12:20 PM, Heiko Schlichting wrote:
Without logging the pid, it is impossible to match 'Disconnected' log entries and the corresponding session start/login.
You can use %p in mail_log_prefix to log imap/pop3 process PID. It
can't be done with login processes, but even if it could be done I
doubt it'd be useful in figuring out the matching login and
disconnect? Unlike other IMAP servers Dovecot's login process doesn't
directly execv() the imap process..
I've thought about this before too though. Maybe some kind of a unique
cookie could be useful.
Timo Sirainen wrote:
On Jul 31, 2008, at 12:20 PM, Heiko Schlichting wrote:
Without logging the pid, it is impossible to match 'Disconnected' log entries and the corresponding session start/login.
You can use %p in mail_log_prefix to log imap/pop3 process PID. It can't be done with login processes, but even if it could be done I doubt it'd be useful in figuring out the matching login and disconnect? Unlike other IMAP servers Dovecot's login process doesn't directly execv() the imap process..
Using mail_log_prefix = "%Ls[%p]: user=<%u>, " is ok but it does not fully solve my problem.
I've thought about this before too though. Maybe some kind of a unique cookie could be useful.
Sounds good but complicated. The only reason why I try to match login and disconnect is that "imap" and "pop3" does not log a starting message (without enabling debug) and login was the only entry during connect. The following minimal patch solves this in a sufficient way and I suggest to adopt it into the official release: --- ./src/imap/main.c.org 2008-07-20 19:57:07.000000000 +0200 +++ ./src/imap/main.c 2008-08-06 12:23:16.000000000 +0200 @@ -286,6 +286,7 @@ lib_init(); drop_privileges(); + i_info("Connected"); process_title_init(argv, envp); ioloop = io_loop_create(); --- ./src/pop3/main.c.org 2008-07-20 19:57:16.000000000 +0200 +++ ./src/pop3/main.c 2008-08-06 12:29:11.000000000 +0200 @@ -268,6 +268,7 @@ lib_init(); drop_privileges(); + i_info("Connected"); process_title_init(argv, envp); ioloop = io_loop_create(); Heiko Schlichting Freie Universität Berlin heiko@FU-Berlin.DE Zentraleinrichtung für Datenverarbeitung (ZEDAT) Telefon +49 30 838-54327 Fabeckstraße 32 Telefax +49 30 838454327 14195 Berlin
On Aug 13, 2008, at 4:59 AM, Heiko Schlichting wrote:
I've thought about this before too though. Maybe some kind of a
unique cookie could be useful.Sounds good but complicated. The only reason why I try to match
login and disconnect is that "imap" and "pop3" does not log a starting message (without enabling debug) and login was the only entry during
connect. The following minimal patch solves this in a sufficient way and I
suggest to adopt it into the official release:
Having these extra "Connected" log lines are pretty pointless for most
people. But this should solve your problem: http://hg.dovecot.org/dovecot-1.2/rev/29b623366e1e
With that patch you can do for example:
login_log_format_elements = user=<%u> method=%m rip=%r lip=%l %c
mailpid=%e
The patch probably doesn't apply to v1.1 code tree though.
Добрый день. I use mail_log_prefix: %p: %r: %Us(%u): result:
dovecot: 11802: 10.0.0.1: POP3(user@host.net): Disconnected: Logged out top=0/0, retr=2/133234, del=2/2, size=133196
В сообщении от Thursday 31 July 2008 14:20:39 Heiko Schlichting написал(а):
Hi,
LOG_NDELAY is the only option for openlog() in dovecot 1.1.2. Wouldn't be LOG_NDELAY|LOG_PID as option parameter much more useful? Without logging the pid, it is impossible to match 'Disconnected' log entries and the corresponding session start/login. Therefore I suggest to use
LOG_NDELAY|LOG_PID
in the options of i_set_failure_syslog() at all 6 occurrences which passes it to openlog().
I know that it is possible to - use logging to file - patch it myself but I can't see good reasons in not using LOG_PID here. As far as I know, most other programs specify LOG_PID.
Without LOG_PID: Jul 31 10:21:08 name dovecot: IMAP(hsg): Disconnected: Logged out bytes=28/242
With LOG_PID: Jul 31 10:21:08 name dovecot[17016]: IMAP(hsg): Disconnected: Logged out bytes=28/242
Heiko
Heiko Schlichting Freie Universität Berlin heiko@FU-Berlin.DE Zentraleinrichtung für Datenverarbeitung (ZEDAT) Telefon +49 30 838-54327 Fabeckstraße 32 Telefax +49 30 838454327 14195 Berlin
-- С уважением, Алексей Горбов ЦПД ТЦ ОАО "ВолгаТелеком" gaa@udmvt.ru
participants (3)
-
Alexey Gorbov
-
Heiko Schlichting
-
Timo Sirainen