Dovecot unified event filtering

Aki Tuomi aki.tuomi at open-xchange.com
Mon Mar 20 11:29:27 UTC 2023


> On 20/03/2023 13:21 EET Felix Auringer <felix.auringer at 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:
> 
> ```c
> 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-language) 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):
> 
> 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


More information about the dovecot mailing list