@webimpian/zonemta-log-central
v1.0.2
Published
ZoneMTA plugin that ships mail delivery logs (queued, delivered, deferred, bounced) to a Log Central server.
Maintainers
Readme
ZoneMTA → Log Central
ZoneMTA plugin that ships mail delivery logs to a Log Central server: every queued, delivered, deferred, and bounced message becomes a searchable log entry with message-id, recipient, sending zone, and the remote MX response.
Built on @webimpian/log-central-node — batched background delivery, capped backoff, and bounded memory, so a Log Central outage can never disrupt mail flow. Hook handlers swallow their own failures and always advance ZoneMTA's plugin chain.
Installation
Inside your ZoneMTA application directory:
npm install @webimpian/zonemta-log-centralEnable the plugin in the ZoneMTA config:
# config/plugins/log-central.toml
["modules/@webimpian/zonemta-log-central"]
enabled=["receiver", "main", "sender"]
url="https://logs.example.com/api"
token="your-project-key"
app="your-mta-slug"
environment="production"
channel="zonemta"Alternatively, if you keep local plugins in a plugins/ folder, drop in a one-line shim as plugins/log-central.js:
module.exports = require('@webimpian/zonemta-log-central');and enable it as ["log-central"] with the same options.
What gets logged
| ZoneMTA hook | Level | Entry |
|---|---|---|
| message:queue | info | Message accepted into the queue (id, from, recipients, interface) |
| sender:delivered | info | MX accepted the message (recipient, zone, MX response) |
| sender:responseError | warning | Delivery deferred/failed (recipient, zone, error response) |
| queue:bounce | error | Message bounced permanently (recipient, response, category) |
| log:entry | debug | Raw ZoneMTA message-event feed — off by default |
Toggle any of them in the config:
["modules/@webimpian/zonemta-log-central".events]
queued=false
raw=trueOptions
| Option | Default | Purpose |
|---|---|---|
| url | (required) | Log Central ingest base URL, e.g. https://logs.example.com/api |
| token | (required) | The app's project key (bearer token) |
| app | (required) | The app's slug, must match the token's app |
| environment | production | Environment tag on every entry |
| channel | zonemta | Log channel shown in the Log Central viewer |
| hostname | os.hostname() | Hostname tag on every entry |
| batchSize / flushInterval / maxQueue | see client | Passed through to @webimpian/log-central-node |
| events | all on, raw off | Toggle individual hooks (see above) |
If url, token, or app is missing, the plugin logs a warning through ZoneMTA's logger and disables itself — it never prevents ZoneMTA from starting.
Testing
npm install
npm testLicense
MIT — see LICENSE.md.
