Logging Strategies: Triggers, Deadbands and Aggregation
Periodic, on-change, pre-trigger ring buffers, min/mean/max aggregation and burst capture, and what each saves and hides.
Why not log everything?
Recording every sample at the highest rate is simple and, up to a point, cheap. But volume costs: storage, bandwidth, battery, upload fees, and above all the time to find the interesting minute in a terabyte. A logging strategy decides which samples are kept. The aim is to store less without losing the information you need, and to know what each strategy hides.
| Strategy | Keeps | Hides |
|---|---|---|
| Periodic | A sample every interval | Anything faster than the interval |
| On change (deadband) | A value when it moves by more than a band | Changes smaller than the band; the time between records unless a heartbeat is added |
| Triggered (with pre-trigger) | A window of fast data around an event | Everything outside events, and events the trigger misses |
| Aggregated | Min, mean, max (and count) per interval | The shape inside the interval |
| Burst | Short fast records at set times | Everything between the bursts |
Periodic logging
The default: one record every fixed interval. It is easy to analyze, since the samples are evenly spaced and every tool understands them. Choose the interval from the process (see Planning a Logging System) and filter before sampling (see Sampling, Aliasing and Filtering). Its weakness is a fixed price: a steady plant at 1 Hz stores the same as a violent one.
On change: deadbands
A deadband stores a value only when it differs from the last stored value by more than a set amount. A steady signal produces almost nothing; a moving one produces many records. Always add a heartbeat, a record at least every so often even if nothing changed, so that you can tell “no change” from “logger dead”.
Worked example: a 0.3 deadband
- The example signal has 600 samples. With a deadband of 0.3 and a heartbeat every 50 samples, 51 records are stored: 8.5 % of the original.
- Holding each stored value until the next (a “step” reconstruction), the worst difference from the true signal is 0.30, set by the band. Choose the band as the error you can accept: about the sensor accuracy or the noise.
- Noise sets a floor. If the noise has a standard deviation of 0.4 and the band is 0.3, random noise alone exceeds the band on about 45 % of samples, so a deadband below the noise level saves almost nothing. Filter first, or set the band above 2 to 3 × the noise.
- Compare with the last stored value, not the last sample, or a slow ramp never triggers.
- Use hysteresis for alarms (for example trip at 80, clear at 78), or a signal near the limit logs and alarms continuously.
- Log the time with every record: the spacing is irregular, so analysis must resample (see Data, Files and Parsing).
- Industrial historians use swinging-door compression, a refinement of the deadband that fits a straight line through the points within a tolerance.
Triggers and the pre-trigger buffer
To catch a rare, fast event (a fault, a spike, an impact) you cannot store everything at full rate. A trigger starts a fast recording when a condition occurs. But the interesting part is often what happened before the trigger, so the logger keeps a circular ring buffer of the most recent samples and, on a trigger, saves the buffer plus a post-trigger period.
Worked example: capturing a fault at 10 kHz
- 4 channels at 10 000 Hz and 2 bytes: continuous recording is 6.91 GB a day.
- Keep 0.5 s before and 1.5 s after each trigger: the ring buffer holds 5 000 samples per channel, 40.0 kB of RAM. Each event stores 160.0 kB.
- With 20 events a day the file growth is 3.2 MB: 2 160 times less than continuous.
- Trigger types: level (above a value), slope (rising faster than a rate), window (leaves a band), pattern (a digital input or a status bit) or a combination. Add a manual trigger button.
- Log what triggered: the time, the level and the channel, with the event, and a counter so that missed events show.
- Test the trigger with a deliberate event; a trigger set too high records nothing and looks like “all is well”.
Aggregation: min, mean, max
Instead of storing every sample, store the minimum, mean and maximum (and sometimes the count and standard deviation) over each interval. The mean gives the trend, and the min and max keep the extremes that a plain average would erase.
Worked example: why the extremes matter
- Sample a pressure signal 10 times a second and aggregate each minute: 600 samples per channel become one record.
- Six channels of raw 2-byte data are 7.2 kB a minute; the aggregate (3 values × 4 bytes × 6 channels + an 8-byte time) is 80 bytes: 90 times smaller.
- A 10 ms spike to 29 on a steady 21 in a 600-sample interval moves the mean by only 0.01 (to 21.01), invisible in the average. The maximum records 29 exactly.
- Align intervals to the clock (on the minute, on the hour) so that data from several loggers lines up (see Time Stamps and Clocks).
- Weight a time-weighted mean when samples are irregular, or for on-change data.
- Averaging angles needs vectors, not numbers: the mean of 359° and 1° is 0°, not 180° (wind direction is the classic case).
- Counters and energy are summed or differenced, not averaged: store the totaliser value.
- Keep a count of valid samples in each interval, so that an average of three readings is not mistaken for one of six hundred.
Burst and adaptive logging
Worked example: vibration bursts
- Recording one vibration channel continuously at 5 000 Hz and 2 bytes is 864.0 MB a day.
- Recording a 2 s burst 4 times an hour is 1.9 MB a day: 450 times less, and enough to follow the spectrum over weeks.
- Store a few features with each burst (RMS, peak, dominant frequency), so that trends can be plotted without reopening the raw files.
- Adaptive rate: log slowly in steady running and fast when a quantity is moving or an alarm is active, and record the rate with the data.
- Scheduled bursts catch slow trends in fast signals; event bursts catch the rare ones; use both.
- Edge processing: compute the FFT or the RMS on the logger and send the result, keeping raw data only when something looks wrong.
Comparing the strategies
| Need | Use | Remember |
|---|---|---|
| Evenly spaced trends of a slow process | Periodic | Interval about τ ÷ 5 |
| Mostly steady plant with occasional moves | Deadband + heartbeat | Band above 2 to 3 × noise; log the time |
| A rare fast fault | Trigger + ring buffer | Pre-trigger time; test the trigger |
| Long-term summary of a fast signal | Min / mean / max per interval | Keep the extremes and the count |
| Condition monitoring of machinery | Bursts + features | Fixed operating conditions for comparable bursts |
| Compliance record | Periodic at a defined interval, plus alarms | Do not reduce data that rules say to keep |
Pitfalls
| Problem | Result | Prevention |
|---|---|---|
| Deadband smaller than the noise | Almost no saving, noisy record | Filter or raise the band |
| No heartbeat | A flat stretch cannot be told from a dead logger | Always store a periodic record |
| Trigger never fires, or fires constantly | No data, or a full card in an hour | Test with a real event; add a re-arm time and a daily event cap |
| Averaging hides the extreme | A real excursion is missed in a report | Store min and max with the mean |
| Mixed strategies without a note | Later users assume even spacing | Record the strategy, band and interval in the metadata |
| Thinning before filtering | Aliasing (see Sampling, Aliasing and Filtering) | Low-pass or average, then keep every Nth |
Related
- Data Logging: the overview of this guide.
- Storage, Formats and Data Rates: what each strategy saves in bytes.
- Data Quality, Analysis and Reporting: checking irregular and aggregated data.
- Embedded Systems: ring buffers and timers in firmware.
- Machine Learning: using features and events for prediction.
FAQ
What deadband should I use?
About the accuracy of the sensor, and above two to three times the noise. Anything smaller stores noise. Always add a heartbeat record.
How long should the pre-trigger be?
Long enough to show the cause: several times the time scale of the build-up to the event. Start with 10 to 30 % of the whole record and adjust after the first events.
Does averaging lose information?
Yes: the shape and the extremes inside the interval. Store the min and max with the mean, and keep raw data when you can.
Can I reduce data after the fact?
Yes, from the raw data, with filtering first. You cannot recover detail that was thinned or averaged away at the logger.
References
- OSIsoft / AVEVA PI documentation on exception reporting and swinging-door compression; Bristol, E. H., “Swinging door trending”, ISA Transactions, 1990.
- Smith, S. W., The Scientist and Engineer’s Guide to Digital Signal Processing (decimation).
- Vendor application notes on trigger and pre-trigger modes (National Instruments, Keysight, HOBO).
Last reviewed: October 2026. Event rates and file sizes are examples: use your own signals.
