Hey gang. I’ve noticed that any headers I import via import_x_headers that has a - will not import. For instance, Subject imports just fine, List-Id does not. I’ve tried specifying headers in all possible cases and with an underscore instead of a dash (ex: list-id, list_id). No matter what, if the header has one or more - in it, it’s not imported into the meta data for the logs. (X-* headers do import, but not headers that are not X headers that have a dash)
kumo.configure_local_logs {
-- This is convenient, but costly! Prefer to capture the
-- headers into meta and log those instead, as shown in
-- the example below!
headers = { 'Subject', 'X-Client-ID' },
}
Yeah you can get headers into meta during reception easily because it’s still in active memory being processed. You specify headers in the logger and it has to re-parse the message.
You can use msg:import_x_headers with any headers, not just X- headers. I think the confusion is with - vs. _ in the example you shared.
You want to import the header name message-id (with a dash, and the name is case in-sensitive), but because the imported header must be a valid JSON object field name, the resulting imported name is message_id (all lower case, with an underscore), which is what you see in the example that you referenced from the docs.
You can fix the code that you shared up the top like this:
yep that was the issue. log_parameters needs underscores, import_x_headers needs dashes. I tried both but didn’t try underscores for one and dashes for the other. Thanks Wez!