Knowledge base

user-string

<acct-file>

A constant string added to every accounting record
in the configuration this is a lineuser-stringinside the block <acct-file>
A label that identifies where a record came from

The line sets arbitrary text that the engine puts into the userstring field of every record of this stream.

🔴 By itself it does nothing. The userstring field must be listed in record-fields — otherwise the value simply will not get into the file. There will be no error.

The practical point is labeling the source. Records from all nodes of the fleet flow into one place, and the label answers the question “where did this line come from”: the node number, the site, the configuration version.

The value is constant. It depends neither on the message nor on the recipient — it is a property of the accounting block, not of an event.

The main trap is setting the string and not seeing it in the file. The cause is always the same: the userstring field is not listed in the field set. With the * set it gets in automatically, with an explicit list it does not.
What the Hub does. It does not write it: we identify the node by the webhook address — it contains the node number (/api/telemetry/pmta/<number>), and the receiver takes it from there.

The line would be useful if records were collected from files rather than arriving in batches from a known address.

Recommended values

The label answers the question “where did the record come from”:

Value When
do not set the source is known by another sign
the node number or name records from all nodes flow into one place
the configuration version you need to know under which setting the data was obtained

And check that the userstring field gets into the set — with * it gets in by itself.

The requirement to list the userstring field comes from the manual (§ 3.3.11.8). The uses of the label are ours.
Example configuration
# the label gets into the file only together with the field in the set
<acct-file /var/log/pmta/acct.csv>
    records d, b
    record-fields d timeLogged,rcpt,vmta,userstring
    user-string node-7-fra</acct-file>
With the * set there is no need to list the field — it gets in by itself. An explicit list without it silently swallows the label.
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▶

Setting the string with an explicit field list

§ 3.3.11.8

What it costsThe userstring field did not get into the list, and the label is written nowhere. There is no error — just empty.
How to spot itThe line is in the configuration, but the file has no such column.
How to do it rightAdd userstring to record-fields for the needed record type.
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
user-string <string>
Values
an arbitrary string
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
There is no inheritance: the line lives inside its <acct-file> and labels only its records. Two accounting streams can carry different labels — that is the usual way to tell them apart on the receiving side.
How to check on the node
Look at the column in the file itself:
head -2 "$(ls -t /var/log/pmta/acct-*.csv | head -1)"
No userstring column means the field is not listed in the set. The column is there but empty means the string itself is not set.
In the Hub
Cost of a mistake
reversible: harms only while it is set
Scenarios
Collect telemetry