Knowledge base

count-moved-records

<acct-file>

Whether to count the records in a file being moved
in the configuration this is a linecount-moved-records falseinside the block <acct-file>
How many records the closed file had

When the engine closes an accounting file and moves it, it writes about this to its log. The line adds the number of records in the file to that message. The default is false.

It is about CSV files only — so the manual says.

Why it is needed. A number in the log is a figure independent of the parsing side: how many records the node really wrote. If the statistics collector says “9,000 received” and the node log says “the file had 10,000”, the discrepancy is visible at once, without parsing the files themselves.

The price is counting at every close. On large files this means an extra pass over the file at the moment it is already on its way out.

The main trap is looking for this number in the wrong place. It goes into the engine log, not into the accounting file and not into its name. Yet people usually look for it in the accounting itself.
What the Hub does. It does not write it — our accounting files are not moved (move-to is not set), so there is no move message to which the count would be appended. The acct-*.csv files are read by “Accounting stats” right on the node, and the telemetry stream arrives via the webhook, where the receiver counts the records itself.

The line would be useful when investigating discrepancies between node accounting and our database — as an independent counter on the node side, but only together with moving the files.

Recommended values

It is enabled when reconciling:

Value When
false (default) always
true we are investigating a discrepancy between the node and the collector

On a stream the counting is noticeable — it makes sense to enable it for the duration of the investigation.

The false default, the log entry together with the move message and the restriction to the CSV format come from the manual (§ 3.3.11.14). The use for reconciliation is ours.
Example configuration
# while investigating discrepancies between the node and the collector
<acct-file /var/log/pmta/acct.csv>
    move-to /var/log/pmta/archive
    move-interval 1h
    count-moved-records yes</acct-file>
The number will appear in the engine log next to the message about moving — not in the accounting file and not in its name.
yellow — — directive names, blue — blocks. They are highlighted the same way in the text of the card.
▲

Common mistakes and problems

what people get wrong and how it ends1 mistake▶

Expecting a record count with moving turned off

§ 3.3.11.14

What it costsThe number is appended to the message about moving. No move-to — no message, and so no number.
How to spot itThe line is on, nothing has changed in the log.
How to do it rightSet a destination directory, or count the records yourself — from the file.
Compatibility
PowerMTA 6.0
described in the manual of this version · platform: any
The vendor does not state the first version for every directive — there is no note here. The name also appears in the 5.0 edition of the manual.
Reference data
Syntax
count-moved-records <boolean>
Values
yes | no | true | false
Default
false § 3.3.11.14
Applying
reload, no restart needed
Queue
will not touch what is already queued
Where to write it
<acct-file>
How many times
once in the block
Everything here comes from the manual, with the section.
Inheritance
No inheritance: the line lives inside its own <acct-file> and concerns messages only about its files.
How to check on the node
The number is looked for in the engine log, next to the move message:
grep -i "moved" /var/log/pmta/log | tail -10
With the line on, the message will include the number of records. Empty — either the files are not moved (no move-to), or the format is not CSV.
In the Hub
Cost of a mistake
reversible: harms only while it is set
Scenarios
Collect telemetry