How-to
Sampling realtime data with the ctrlX Telegraf app
Short answer
On a ctrlX CORE X3 or X7, or ctrlX OS 2.6 and later, set the Telegraf app sampling interval to 0 to activate the lossless subscription, set lossless_rate_limit to 1 to upload every sample, and size queue_size so the buffer outlasts the longest expected write outage. Subscribe only to realtime_data nodes, run calculations in the EtherCAT-synchronous PLC task, and prove the stored sequence with a controlled destination outage.

On this page
On a ctrlX CORE X3 or X7, or on a ctrlX OS installation at version 2.6 or later, the Telegraf app can subscribe straight to Data Layer realtime nodes and store every sample in InfluxDB with no programming. Three settings carry the whole function: sampling interval 0 activates the lossless subscription, lossless_rate_limit 1 uploads all data, and queue_size sizes the upload buffer. This walkthrough collects high-frequency signals for condition monitoring directly through Telegraf. If you already collect these signals as flows, the same controller can also run Running PLC logic and Node-RED on one ctrlX CORE; this route is pure configuration, easier to reproduce, and leaves no flow logic to maintain.
Requirements before you configure #
Have these in place before touching any subscription setting:
- A ctrlX CORE X3 or X7 controller, or a ctrlX OS installation at version 2.6 or later; this walkthrough was commissioned on version 2.6.
- The Telegraf app installed and running, ready to collect, process and forward Data Layer data to a target database.
- The InfluxDB app installed, configured and accepting writes.
- At least one active realtime producer: a PLC application updating a realtime variable, or an EtherCAT master with the fieldbus running.
If the database does not sit on the controller itself, check the physical link and address reachability before anything else, and read the destination address, port and authentication settings from the actual Telegraf output configuration — the two app names alone do not define those values. An inactive producer and an unreachable database cannot be fixed by any subscription setting, so prove both, then continue. If collection is meant to run on a separate box instead of the controller, size it with Sizing an edge PC for oversampled PLC data to InfluxDB.
Confirm the node is realtime data #
The subscription needs realtime data, not a value that an ordinary application refreshes on a scan cycle; a subscription to a periodic copy produces plausible trends while silently dropping the intended sample sequence. The two demonstrated path families are:
plc/app/Application/realtime_data/..for PLC application realtime variablesfieldbuses/ethercat/master/instances/ethercatmaster/realtime_data/..for EtherCAT master realtime signals
The trailing double dot marks a path family, not a complete address. Browse to the actual variable beneath the branch, check its data type, and compare its live value against the producing application or fieldbus signal. For an EtherCAT-derived value, confirm the fieldbus is in operation before blaming the subscription.
Decision: subscribe only to a node under a realtime_data branch whose live value tracks the source; the rest of this walkthrough assumes that check has passed.
Put calculations in the EtherCAT-synchronous task #
When a stored signal must be computed first, run the calculation in an EtherCAT-synchronous task in the PLC app and write the result into a realtime PLC data location, then subscribe to that result node. A custom realtime application works too, but the PLC route needs nothing beyond ordinary PLC logic.
Placement matters because acquisition and calculation must share a defined timing relationship. Reading a realtime signal from an unrelated task puts a different update cadence into the result, and Telegraf collects whatever that result contains — it cannot restore samples the calculation stage never saw.
Decision: subscribe to the original node for the raw sequence; compute in the EtherCAT-synchronous task and subscribe to the result node for a derived feature. Confirm the result updates inside that task and appears at the chosen node before configuring its collection.
Configure the three subscription settings #
- Open the Telegraf app configuration and select the verified realtime node as the subscription input.
- Set the sampling interval to 0. Zero is an activation value here, not a sampling period: it switches the lossless subscription on.
- Set lossless_rate_limit to 1 to upload all data. The value 10 uploads one value for every ten values — only acceptable when one-in-ten retention still meets the monitoring objective, because selection is not averaging and short peaks between kept samples disappear.
- Set queue_size to the buffer depth derived in the next section.
- Save and apply; the app stores the configuration automatically in the app data of the ctrlX device.
- Check the Telegraf status for configuration or subscription errors — an error here usually means the selected node is not realtime data, so repeat the branch check above.
With interval 0 and limit 1, every sample the producer generates enters the subscription and is queued for upload; that is the mode for condition monitoring of high-frequency signals. Limit 10 is a deliberate compromise for slow trend views, not a filter.
Size queue_size and storage #
queue_size decides how long the buffer bridges a destination that is slow or briefly offline. Its unit and allowed range come from the configuration documentation of the installed app version; the estimate below assumes the queue counts samples.
Worked example, with illustrative inputs — these are not app defaults. Assume an EtherCAT-synchronous task cycle of 1 ms, so one subscribed signal produces 1000 samples per second. With lossless_rate_limit 1, all 1000 samples per second enter the queue, and a queue_size of 100000 samples covers 100000 samples divided by 1000 samples per second, which gives 100 s of collection.
Switch to lossless_rate_limit 10 and the retained stream is 1000 divided by 10, or 100 samples per second, so the same queue covers 100000 samples divided by 100 samples per second, which gives 1000 s.
Size the queue with that same arithmetic: coverage in seconds equals queue_size divided by the rate entering that queue. Check where the rate limit acts relative to the buffer — if the limit acts before the queue, use the retained rate in the division; if after it, use the producer rate.
Storage scales identically: at 1000 samples per second, one signal accumulates 1000 multiplied by 86400, or 86,400,000 samples in a day, so the bytes each point costs decide the disk budget — the measured per-point cost is covered in What one Telegraf point really costs on InfluxDB disk. For the storage tier behind data of this rate, see Choosing edge storage for high-rate vibration data.
Verify lossless delivery end to end #
A running Telegraf process proves only that the app is up; a changing database value proves only that some writes arrive. Test the lossless behavior directly:
- Stop the InfluxDB app, or block its write port, for a known interval shorter than the buffer coverage — for example 30 s against the 100 s example buffer.
- Let Telegraf keep collecting through the outage, then restart the destination.
- Confirm the backlog drains and the samples from the outage window are stored, with no gap between the values recorded before and after.
If Telegraf reports a refused connection to a remote InfluxDB 2.x target instead of queueing, work through Telegraf remote InfluxDB 2.x connection refused fix and then repeat the test.
Decisions: backlog that drains after the test means the buffer is adequate for that outage length; backlog that grows during normal operation means the destination writes more slowly than collection produces, and the write path needs fixing rather than the buffer enlarging. This path is monitoring only — no protective function may depend on the subscription, the queue or the database.
Questions asked
What happens to samples when the upload queue overflows?
Samples beyond the buffer depth are lost: the lossless subscription preserves data only while the backlog fits the configured queue_size. Backlog that grows during normal operation shows the destination writing more slowly than collection produces, so correct the write path instead of enlarging the buffer again. Backlog that drains after a short outage shows the buffer is already adequate.
Can several realtime signals share one subscription configuration?
Yes. Size the queue and the database for the total sample rate of all subscribed signals, not for one signal. Two signals at the rate of the worked example enter twice the samples each second, which halves the seconds of coverage a given queue_size provides and doubles the stored daily volume.
Is a nonzero sampling interval compatible with lossless collection?
No. Only the value 0 activates the lossless subscription; any nonzero sampling interval configures periodic sampling instead, storing one value per interval and skipping everything between two samples. Choose periodic sampling only when the monitoring objective tolerates those gaps by design.
How does this compare with collecting the same signals in Node-RED?
The Telegraf route is pure configuration with nothing to program, while Node-RED on the same controller offers more logic flexibility at the cost of building and maintaining flows. Both read the same Data Layer realtime nodes, so the choice is about flexibility and maintainability rather than data quality.


