Support client_id variable expansion
Eirik Rye
rye at trojka.no
Wed Jun 2 17:45:57 EEST 2021
Hello,
We are using imap_id_log='*' (and imap_id_retain=yes) to log user client information to the dovecot logs, and this information is aggregated to give us extra debugging information for customer support.
However, as some clients send the ID information pre-login and others send it post-login, the aggregation logic is needlessly complex as we need to correlate the session IDs of the pre-login ID messages in order to determine the correct user.
Hoping to simplify this, I wanted to log the client_id variable on logout, in imap_logout_format:
imap_logout_format = in=%i out=%o deleted=%{deleted} expunged=%{expunged} trashed=%{trashed} hdr_count=%{fetch_hdr_count} hdr_bytes=%{fetch_hdr_bytes} body_count=%{fetch_body_count} body_bytes=%{fetch_body_bytes} client_id="%{client_id}"
However, this only results in the following log being printed:
client_id="UNSUPPORTED_VARIABLE_client_id"
While examining the source code (login-common/client-common.c), it seems like this could be trivially supported by adding `client_id` to the `login_var_expand_empty_tab` struct, and adding the relevant code to populate this variable to `get_var_expand_table(struct client *client)`.
I am willing to write a pull request for this, unless I am missing some obvious reason why expansion of the client's `client_id` field is not supported in the first place?
- Eirik
More information about the dovecot
mailing list