I have the following configuration in init.lua - the log_parameters includes X-CUSTOMER-ID:
log_hooks:new_json {
name = "webhook",
-- log_parameters are combined with the name and
-- passed through to kumo.configure_log_hook
log_parameters = {
headers = { 'Subject', 'X-CUSTOMER-ID' },
meta = { 'tenant' }
},
-- queue config are passed to kumo.make_queue_config.
-- You can use these to override the retry parameters
-- if you wish.
-- The defaults are shown below.
queue_config = {
retry_interval = "1m",
max_retry_interval = "20m",
},
-- The URL to POST the JSON to
url = "http://192.168.0.100:4242/log",
}
-- the rest of the config
kumo.on('http_message_generated', function(msg)
local tenant = cached_tenant_id(msg:from_header().domain)
if tenant then
msg:set_meta('source', 'http')
msg:set_meta('tenant', tenant)
msg:append_header('X-CUSTOMER-ID', tenant)
else
kumo.reject(
500,
string.format("from domain '%s' is not allowed.", msg.from_header().domain)
)
end
print(msg:get_data())
queue_helper:apply(msg)
dkim_signer(msg)
end)
The X-CUSTOMER-ID header is being added to the message on http_message_generated (I see it in the output of print(msg:get_data())), but the payload sent to the webhook does not contain the header:
{"type":"Reception","id":"5cab1f3d92d111eea4dc080027be1609","sender":"noreply@example.com","recipient":"recipient@example.com","queue":"test@example.com","site":"","size":883,"response":{"code":250,"enhanced_code":null,"content":"","command":null},"peer_address":{"name":"","addr":"192.168.0.100"},"timestamp":1701713839,"created":1701713839,"num_attempts":0,"bounce_classification":"Uncategorized","egress_pool":null,"egress_source":null,"feedback_report":null,"meta":{"tenant":"test"},"headers":{"Subject":"This is the subject"},"delivery_protocol":null,"reception_protocol":"HTTP","nodeid":"6c48c1dc-5f6a-487c-ab67-c3e6f426d6a6"}