Skip to content

kumo.configure_log_hook {PARAMS}

Configures the lua logging hook. When enabled, each matching log event will cause cause new a Message to be generated and have its body assigned to the log record (or to its template expansion if you have configured that), and passed to the should_enqueue_log_record event.

kumo.on('init', function()
  kumo.configure_log_hook {
    -- name will be passed to should_enqueue_log_record as the hook_name
    -- parameter so that you can reason about different instances of the
    -- log hook in the case where you are sending data to multiple
    -- different places.
    name = 'webhook',
    headers = { 'Subject', 'X-Customer-ID' },
  }
end)

This allows you to utilize KumoMTA's internal queueing to dispatch log events to external systems such as webhooks or some external queuing system for processing elsewhere in your deployment architecture.

See should_enqueue_log_record for an example.

The following options are configurable for the logging hook and work the same way as their counterparts in local log file logging. Rather than duplicate the information here, this section links to those options:

In addition, the following options are supported:

name

Since: Version 2023.08.22-4d895015

The functionality described in this outlined box requires version 2023.08.22-4d895015 of KumoMTA, or a more recent version.


Required string naming the hook.

The name will be passed as the hook_name parameter to the should_enqueue_log_record event.

deferred_spool

If set to true, the generated message will not be immediately saved to the spool in the case that your should_enqueue_log_record indicates that the message should be queued.