<acct-file>set by the Hub
Usually accounting records sit in a file, and they have to be collected from the node. This line reverses the direction: the node itself sends batches of records to the given address with a POST request.
The file remains, and this is the main thing to understand. The path in the <acct-file> tag does not go anywhere — it becomes intermediate storage. Records accumulate in the file, the file goes to the address and is deleted only after a successful send.
Success is a 2xx response and nothing else. Any other response triggers a retry after a short delay. So an unavailable receiver causes accumulation, not loss — until the disk runs out of space.
The extension in the path decides the format. .json — records in NDJSON and the application/x-ndjson header; any other extension — CSV and text/csv. The type can be overridden only with a headers file (http-webhook-extra-headers).
If the Hub has a local address, the block is not written at all — the node has nowhere to reach. Then telemetry goes by polling through the management interface, and this is visible in the configuration apply log.
The receiver responds quickly on purpose. TelemetryController checks the token, puts the body in the cache and queues a job — parsing happens in the background. Otherwise our analytics would slow down someone else’s mail server: the engine waits for a 2xx.
The address has to be complete, and preferably by name rather than by IP:
| What | Note |
|---|---|
| scheme | https — otherwise the token will travel in plain text |
| port | not specified — 443 for https, 80 for http |
| host name | fully qualified; the engine will complete a partial one for DNS but leave it as is in the Host header |
| IPv6 address | in square brackets |
The file extension in the block tag is part of the configuration: .json gives NDJSON, everything else CSV.
# this is how it looks for us: the .json extension is required <acct-file /var/log/pmta/mtahub-webhook.json> records d, b, rb, t, feedback-loop record-fields d * http-webhook-url https://hub.example.com/api/telemetry/pmta/7 http-webhook-extra-headers /etc/pmta/mtahub-headers.txt http-webhook-max-interval 1m max-size 1M </acct-file>
what people get wrong and how it ends3 mistakes▶
§ 12.1.1
§ 12.1.1
our experience
5 relations
A file, a program or an endpoint — and a file under each of the threeThe third way to hand off accounting records; the rules for intermediate files, retries and headers are described there. § 12.1.1The telemetry contractTurns the accounting stream from a file on disk into sending over the network; the file itself does not go anywhere. § 3.3.11.17
http-webhook-extra-headers<acct-file>The headers are added to the very request that carries the batch. § 3.3.11.18http-webhook-certificate<acct-file>The certificate is presented when contacting that address. § 3.3.11.19http-webhook-ca-file<acct-file>The certificate of that address is verified against these authorities. § 3.3.11.20http-webhook-transfer-encoding<acct-file>Compresses the content of the very request the batch goes out with. § 3.3.11.22http-webhook-log-verbose<acct-file>Writes more detail to the log about sending batches to that address. § 3.3.11.23http-webhook-connect-timeout<acct-file>Limits the wait when establishing a connection to that address. § 3.3.11.24
ls -la /var/log/pmta/mtahub-webhook*
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.