<acct-file>
Accounting records first land in operating system buffers and only then on disk. The line makes them flush regularly. The default is false.
The difference shows only in a crash. On a normal engine stop the buffers flush on their own. The line protects against the sudden — a power loss, a kernel panic, a hard reboot: without it the last records are lost, and the tail of the file may be corrupted.
The price is disk access. Under load accounting is written constantly, and regular flushing turns sequential writing into a series of forced disk accesses. On a node with a fast drive this is barely noticeable, on a slow one it is noticeable.
🔎 We have an argument for this choice, and it is not about the disk: the main accounting stream goes through the webhook, that is, in batches once a minute. The most a crash can lose is an unfinished minute; everything else has already reached us and sits in the database. The file block is a safety net here, and there are no requirements for its tail.
In the main file the template also writes sync-msg-create false and sync-msg-update false — lines from the Protosender configuration that have nothing to do with accounting. The PowerMTA 6 manual has them neither in chapter 3 nor in the index; the nodes accept the lines. Their meaning comes from the comments of the sample configuration of earlier PowerMTA versions: flushing queued messages to disk after receipt and after handled recipients are marked. false is faster, but in a system crash a message not yet written to disk can be lost, and some recipients can get it again.
The decision depends on what the node is risking:
| Value | When |
|---|---|
| false (default) | accounting goes out via webhook, or a gap in statistics is tolerable |
| true | the accounting file is the only source, and the node has unreliable power |
# the accounting file is the only source, and losing its tail is not acceptable <acct-file /var/log/pmta/acct.csv> records d, b sync true</acct-file>
what people get wrong and how it ends1 mistake▶
our experience
1 relation
grep -n -A10 '<acct-file' /etc/pmta/config | grep -i 'sync\|acct-file'
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.