[Dovecot] deliver & per user log file
Hello,
is there a way to log Dovecot deliver actions in user home directory like procmail did (e.g. in ~/Mail/deliver.log)?
Greetings,
-- Marcin Rzepecki m.rzepecki(at)iem.pw.edu.pl
-----Original Message----- From: dovecot-bounces+siebert+lists=et.rub.de@dovecot.org [mailto:dovecot-bounces+siebert+lists=et.rub.de@dovecot.org] On Behalf Of Marcin Rzepecki Sent: Sunday, December 14, 2008 9:51 PM To: dovecot@dovecot.org Subject: [Dovecot] deliver & per user log file
Hello,
is there a way to log Dovecot deliver actions in user home directory like procmail did (e.g. in ~/Mail/deliver.log)?
Greetings,
-- Marcin Rzepecki m.rzepecki(at)iem.pw.edu.pl
This should do what you want:
protocol lda { (...) log_path = %h/Mail/dovecot-deliver.log info_log_path = %h/Mail/dovecot-deliver.log (...) }
Sun, Dec 14, 2008 at 09:58:13PM +0100, Thomas Siebert napisał(a):
is there a way to log Dovecot deliver actions in user home directory like procmail did (e.g. in ~/Mail/deliver.log)?
protocol lda { (...) log_path = %h/Mail/dovecot-deliver.log info_log_path = %h/Mail/dovecot-deliver.log (...) }
Hello, thanks for feedback. I've tried these settings earlier, but I'm getting following error: Can't open log file %h/Mail/deliver.log: No such file or directory
Creating deliver.log file manually and/or giving him wide permissions won't help. I think deliver won't expand '%h' parameter correctly.
-- Marcin Rzepecki m.rzepecki(at)iem.pw.edu.pl
What version do you use? Do you have tried "~/Mail/deliver.log"?
-----Original Message----- From: dovecot-bounces+siebert+lists=et.rub.de@dovecot.org [mailto:dovecot-bounces+siebert+lists=et.rub.de@dovecot.org] On Behalf Of Marcin Rzepecki Sent: Sunday, December 14, 2008 10:08 PM To: Thomas Siebert Cc: dovecot@dovecot.org Subject: Re: [Dovecot] deliver & per user log file
is there a way to log Dovecot deliver actions in user home
Sun, Dec 14, 2008 at 09:58:13PM +0100, Thomas Siebert napisał(a): directory
like procmail did (e.g. in ~/Mail/deliver.log)?
protocol lda { (...) log_path = %h/Mail/dovecot-deliver.log info_log_path = %h/Mail/dovecot-deliver.log (...) }
Hello, thanks for feedback. I've tried these settings earlier, but I'm getting following error: Can't open log file %h/Mail/deliver.log: No such file or directory
Creating deliver.log file manually and/or giving him wide permissions won't help. I think deliver won't expand '%h' parameter correctly.
-- Marcin Rzepecki m.rzepecki(at)iem.pw.edu.pl
Sun, Dec 14, 2008 at 10:53:10PM +0100, Thomas Siebert napisał(a):
What version do you use? Do you have tried "~/Mail/deliver.log"?
I should start with this info ;) I'm running 1.1.7 I've tried with many combinations: ~/Mail/deliver.log; Mail/deliver.log; deliver.log; %h/Mail/deliver.log - without effect
-- Marcin Rzepecki m.rzepecki(at)iem.pw.edu.pl
-----Original Message----- From: dovecot-bounces+siebert+lists=et.rub.de@dovecot.org [mailto:dovecot-bounces+siebert+lists=et.rub.de@dovecot.org] On Behalf Of Marcin Rzepecki Sent: Sunday, December 14, 2008 11:11 PM To: Thomas Siebert Cc: dovecot@dovecot.org Subject: Re: [Dovecot] deliver & per user log file
Sun, Dec 14, 2008 at 10:53:10PM +0100, Thomas Siebert napisał(a):
What version do you use? Do you have tried "~/Mail/deliver.log"?
I should start with this info ;) I'm running 1.1.7 I've tried with many combinations: ~/Mail/deliver.log; Mail/deliver.log; deliver.log; %h/Mail/deliver.log - without effect
-- Marcin Rzepecki m.rzepecki(at)iem.pw.edu.pl
OK, I checked the sources and there is indeed no variable expansion code for this parameters. So for now, I don't see how it is possible from within dovecot. There are probably some cheesy ways to do it via filtering for some syslog daemons, but I feel that variables and "~" should be expanded here. As this should be no complicated fix, maybe when Timo reads this he introduces it in the next version.
Changing two lines in deliver.c and recompiling could provisionally work (untested):
Line 685: log_path = expand_mail_env( getenv("LOG_PATH"), get_var_expand_table(username, getenv("HOME")) );
Line 698: info_log_path = expand_mail_env( getenv("INFO_LOG_PATH"), get_var_expand_table(username, getenv("HOME")) );
Mon, Dec 15, 2008 at 12:45:43AM +0100, Thomas Siebert wrote:
I should start with this info ;) I'm running 1.1.7 I've tried with many combinations: ~/Mail/deliver.log; Mail/deliver.log; deliver.log; %h/Mail/deliver.log - without effect
OK, I checked the sources and there is indeed no variable expansion code for this parameters. So for now, I don't see how it is possible from within dovecot. There are probably some cheesy ways to do it via filtering for some syslog daemons, but I feel that variables and "~" should be expanded here. As this should be no complicated fix, maybe when Timo reads this he introduces it in the next version.
Changing two lines in deliver.c and recompiling could provisionally work [...]
Now 'log_path = %h/.MAIL/deliver.log' works for me! Thank you, Thomas! Here's a patch if someone would like to test this feature: --- src/deliver/deliver.c.orig 2008-11-19 18:43:13.000000000 +0100 +++ src/deliver/deliver.c 2008-12-15 01:30:38.000000000 +0100 @@ -682,7 +682,8 @@ const char *prefix, *log_path, *stamp; prefix = t_strdup_printf("deliver(%s)", username); - log_path = getenv("LOG_PATH"); + log_path = expand_mail_env( getenv("LOG_PATH"), + get_var_expand_table(username, getenv("HOME")) ); if (log_path == NULL || *log_path == '\0') { const char *env = getenv("SYSLOG_FACILITY"); int facility; @@ -695,7 +696,8 @@ i_set_failure_file(log_path, t_strconcat(prefix, ": ", NULL)); } - log_path = getenv("INFO_LOG_PATH"); + log_path = expand_mail_env( getenv("INFO_LOG_PATH"), + get_var_expand_table(username, getenv("HOME")) ); if (log_path != NULL && *log_path != '\0') i_set_info_file(log_path); -- Marcin Rzepecki m.rzepecki(at)iem.pw.edu.pl
On Sun, Dec 14, 2008 at 10:48 PM, Marcin Rzepecki <m.rzepecki@iem.pw.edu.pl> wrote:
Now 'log_path = %h/.MAIL/deliver.log' works for me! Thank you, Thomas! Here's a patch if someone would like to test this feature:
--- src/deliver/deliver.c.orig 2008-11-19 18:43:13.000000000 +0100 +++ src/deliver/deliver.c 2008-12-15 01:30:38.000000000 +0100 @@ -682,7 +682,8 @@ const char *prefix, *log_path, *stamp;
prefix = t_strdup_printf("deliver(%s)", username); - log_path = getenv("LOG_PATH"); + log_path = expand_mail_env( getenv("LOG_PATH"), + get_var_expand_table(username, getenv("HOME")) ); if (log_path == NULL || *log_path == '\0') { const char *env = getenv("SYSLOG_FACILITY"); int facility; @@ -695,7 +696,8 @@ i_set_failure_file(log_path, t_strconcat(prefix, ": ", NULL)); }
- log_path = getenv("INFO_LOG_PATH"); + log_path = expand_mail_env( getenv("INFO_LOG_PATH"), + get_var_expand_table(username, getenv("HOME")) ); if (log_path != NULL && *log_path != '\0') i_set_info_file(log_path);
Same here. Really nice. Is there any chance this feature could be added to the 1.1 branch? Regards Miguel
On Mon, 2008-12-15 at 01:48 +0100, Marcin Rzepecki wrote:
Now 'log_path = %h/.MAIL/deliver.log' works for me! Thank you, Thomas! Here's a patch if someone would like to test this feature:
I made it just expand ~/ at the beginning: http://hg.dovecot.org/dovecot-1.1/rev/e922f0b6436e
participants (4)
-
Marcin Rzepecki
-
Miguel Filho
-
Thomas Siebert
-
Timo Sirainen