Dovecot unified event filtering
Hello,
I have an issue with debug logging when using a custom plugin for Dovecot. In my plugin, I create a child event of the session's user event:
struct event *plugin_event = event_create(list->ns->user->event);
event_set_name(plugin_event, "oidc_shared_mailboxes_plugin");
event_set_min_log_level(plugin_event, LOG_TYPE_WARNING);
event_set_append_log_prefix(plugin_event, "oidc-shared-mailboxes-plugin: ");
I then use passthrough events like the following:
e_debug(event_create_passthrough(data->event)->event(), "Modified mailbox_list_iter_init was called.");
e_warning(event_create_passthrough(event)->event(), "Did not find required key 'roles' in the JWT body.");
e_warning
and e_error
work fine.
If I understand the documentation for the unified event filtering (https://doc.dovecot.org/configuration_manual/event_filter/#unified-filter-la...) correctly, I should be able to enable debug logging for with log_debug = event="oidc_shared_mailboxes_plugin"
. However, this setting has no influence on the logging behavior. The setting I have to set for the debug logging to work is mail_debug = yes
(I do not have to set log_debug
at all).
Is this intended behavior or am I doing something wrong?
Best regards, Felix Auringer
Here is the output of dovecot -n
(I removed the passdb, userdb, namespace, service, and managesieve settings as they cluttered the output):
# 2.3.19 (b3ad6004dc): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.19 (4eae2f79)
# OS: Linux 5.10.0-15-amd64 x86_64 Debian 11.6
# Hostname: c3dd5b346d22
auth_mechanisms = plain login xoauth2 oauthbearer
debug_log_path = /dev/stdout
disable_plaintext_auth = no
first_valid_uid = 1000
info_log_path = /dev/stdout
last_valid_uid = 1000
log_debug = event="oidc_shared_mailboxes_plugin"
log_path = /dev/stdout
login_greeting = Hello there! .... GIZ Mail!
mail_location = maildir:~/mail
mail_plugins = " oidc_shared_mailboxes"
plugin {
oidc_shared_mailboxes_client_id = dovecot-test
}
protocols = imap lmtp
Gesellschaft für interkulturelles Zusammenleben gGmbH (GIZ) Felix Auringer IT Reformationsplatz 2 13597 Berlin
Tel: 030/513 0100 00; Fax: 030/513 0100 09 www.giz.berlin; felix.auringer@giz.berlin
Amtsgericht Charlottenburg HRB 200872 B Geschäftsführerin: Dr. Britta Marschke
On 20/03/2023 13:21 EET Felix Auringer <felix.auringer@giz.berlin> wrote:
Hello,
I have an issue with debug logging when using a custom plugin for Dovecot. In my plugin, I create a child event of the session's user event:
struct event *plugin_event = event_create(list->ns->user->event); event_set_name(plugin_event, "oidc_shared_mailboxes_plugin"); event_set_min_log_level(plugin_event, LOG_TYPE_WARNING); event_set_append_log_prefix(plugin_event, "oidc-shared-mailboxes-plugin: ");
I then use passthrough events like the following:
e_debug(event_create_passthrough(data->event)->event(), "Modified mailbox_list_iter_init was called."); e_warning(event_create_passthrough(event)->event(), "Did not find required key 'roles' in the JWT body.");
e_warning
ande_error
work fine. If I understand the documentation for the unified event filtering (https://doc.dovecot.org/configuration_manual/event_filter/#unified-filter-la...) correctly, I should be able to enable debug logging for withlog_debug = event="oidc_shared_mailboxes_plugin"
. However, this setting has no influence on the logging behavior. The setting I have to set for the debug logging to work ismail_debug = yes
(I do not have to setlog_debug
at all).Is this intended behavior or am I doing something wrong?
Best regards, Felix Auringer
Here is the output of
dovecot -n
(I removed the passdb, userdb, namespace, service, and managesieve settings as they cluttered the output):Felix Auringer IT
Hi!
Usually this is used like this:
const struct event_category cat_oidc = { .name = "oidc" };
struct event *plugin_event = event_create(list->ns->user->event); event_add_category(plugin_event, &cat_oid); event_set_append_log_prefix(plugin_event, "oidc-shared-mailboxes-plugin: ")
...
e_debug(plugin_event, "foo"); e_warning(plugin_event, "bar");
now you can do
log_debug = category=oidc
Aki
participants (2)
-
Aki Tuomi
-
Felix Auringer