There are two formats, and the choice between them is not configured with a directive. It is made by the extension in the block’s path: .json gives JSON, anything else gives CSV. The pipe form always writes CSV.
CSV — per RFC 4180, in UTF-8, with a header line. The first column is always the record type — that is what makes it possible to keep several types in one file. The price of such a mix: the header carries all columns of all selected types, and each line fills only its own.
JSON — one object per line, no header, the NDJSON format. Each record is self-describing: all configured fields are present in it, even empty ones. The shared header problem does not exist at all.
🔴 The extension also decides the webhook’s content type header: .json gives application/x-ndjson, everything else text/csv. So a path changed for a completely different reason silently changes the format of the data sent, and the receiver will break on data that looks correct.
The timestamp format is configured separately — iso-times, and it is shared by both formats.
Telemetry goes to .json, that is, NDJSON: the receiver parses the batch line by line, and each record is self-describing. The extension here is part of the protocol, not decoration — the configurator code marks this with a comment, because with any other extension CSV would arrive and there would be nothing to parse the batch with.
The safety-net file is .csv, with the default record types (d,b), and a mix of two types in it is tolerable.
The mechanism has no values of its own: the path chooses the format.
| The path ends with | Format | Webhook content type |
|---|---|---|
| .json | NDJSON, no header | application/x-ndjson |
| anything else | CSV with a header | text/csv |
| a pipe | CSV | — |
The content type can be overridden only with the http-webhook-extra-headers file.
# the extension is part of the protocol, not decoration <acct-file /var/log/pmta/mtahub-webhook.json> records d, b, rb, t, feedback-loop http-webhook-url https://hub.example.com/api/telemetry/pmta/7 </acct-file>
what people get wrong and how it ends2 mistakes▶
our experience
§ 12.1.2.2
2 relations
head -1 "$(ls -t /var/log/pmta/acct-*.csv | head -1)"
3 articles
◇What the node tells about itself and through which channelsSeven observation surfaces: the web monitor, the console in four formats, the log, accounting, accounting search, metrics and export to external analytics.◇Two inbound report processors and what to do with themBounces by message and complaints are parsed by two identically structured blocks; each has its own address list and its own pair of decisions about the message’s fate.◇Five ways for a queue to hand off a messageA queue does not have to use SMTP: it can write to a file, run a program, call over HTTP or discard.