Can Telegraf's disk buffer survive a sudden power loss and recover data afterwards?
Relevant telegraf.conf
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 5000
metric_buffer_limit = 80000
flush_interval = "50s"
buffer_strategy = "disk"
buffer_directory = "/var/lib/telegraf/buffer"
buffer_disk_sync = trueLogs from Telegraf
Steps to reproduce ->System info
Telegraf version: 1.39.3 OS: Debian 13.6 amd64 Hardware: Orange Pi 3 LTS
Docker
No response
Steps to reproduce
Laptop InfluxDB was stopped
The laptop InfluxDB was stopped at approximately:
03:52:42
Telegraf continued receiving MQTT metrics.
I waited until approximately 03:58:06 so that metrics had accumulated in the laptop output's disk buffer.
Then I checked the buffer:
sudo du -ah /var/lib/telegraf/buffer | sort -h
Output:
0 /var/lib/telegraf/buffer/eda928.../00000000000000444464.START.TEMP 0 /var/lib/telegraf/buffer/eda928.../00000000000001118574.START.TEMP 0 /var/lib/telegraf/buffer/eda928.../00000000000001118976.START.TEMP 16K /var/lib/telegraf/buffer/eda928.../00000000000001289710 20K /var/lib/telegraf/buffer/eda928... 92K /var/lib/telegraf/buffer/9d460... 96K /var/lib/telegraf/buffer/9d460... 120K /var/lib/telegraf/buffer
The laptop output buffer was approximately 92 KB at this point.
I then captured the exact file sizes:
date sudo find /var/lib/telegraf/buffer -type f -printf '%s %p\n' | sort -n
Output:
Thu Sep 24 03:58:40 MSK 2026
0 .../eda928.../00000000000000444464.START.TEMP 0 .../eda928.../00000000000001118574.START.TEMP 0 .../eda928.../00000000000001118976.START.TEMP 14551 .../eda928.../00000000000001289710 87183 .../9d460.../00000000000000004047
So immediately before the power loss, the laptop output's WAL file was:
87183 bytes 2. Hard power loss
I physically disconnected power from the Orange Pi.
This was an actual unexpected power loss, not:
systemctl stop telegraf
or a graceful shutdown.
The laptop InfluxDB remained OFF.
- Orange Pi rebooted
After the Orange Pi came back up, the laptop InfluxDB was still OFF.
I immediately checked the disk buffer again:
sudo du -ah /var/lib/telegraf/buffer | sort -h
Output:
0 .../eda928.../*.START.TEMP 16K .../eda928.../00000000000001289744 20K .../eda928... 104K .../9d460.../00000000000000004047 108K .../9d460... 132K /var/lib/telegraf/buffer
This is an important observation:
The laptop WAL physically survived the unexpected power loss.
It was approximately 104 KB after reboot and the laptop InfluxDB was still unavailable.
Telegraf was running normally after the reboot.
Later, while the laptop InfluxDB was still unavailable, Telegraf was also processing new metrics.
- Laptop InfluxDB was started
I then started the laptop InfluxDB.
After it became available, I checked the disk buffers again:
sudo du -ah /var/lib/telegraf/buffer | sort -h
Output:
0 .../9d460.../00000000000000004353 0 .../eda928.../*.START.TEMP 0 .../eda928.../00000000000001289846 4.0K .../9d460... 4.0K .../eda928... 12K /var/lib/telegraf/buffer
The laptop WAL had effectively been drained/cleared.
However, the historical metrics that had accumulated in that WAL did not appear in the laptop InfluxDB.
- Grafana verification
I checked the laptop Grafana directly.
There were no data points corresponding to the queued period.
The observed gap was approximately:
last point before outage: 03:52:09 first new point after recovery: approximately 04:02:10
The metrics generated while the laptop InfluxDB was unavailable were missing.
This was also checked against the Grafana data rather than relying only on Telegraf's buffer size.
Expected behavior
With buffer_strategy = "disk" and buffer_disk_sync = true configured, I expected that metrics accumulated while the Laptop InfluxDB was unavailable would be written to the disk buffer, survive an unexpected power loss of the Orange Pi, and be automatically replayed to the Laptop InfluxDB once it became available again after reboot.
Actual behavior
Actual behavior (brief): Laptop InfluxDB stopped → WAL grew to ~87 KB. Sudden power loss on Orange Pi. After reboot, WAL survived (~104 KB). Laptop InfluxDB started → WAL drained/cleared. But historical metrics from the outage period never appeared in InfluxDB — Grafana gap from 03:52:09 to ~04:02:10. No write errors in Telegraf journal.
Additional info
MQTT input on the same Orange Pi
Is this expected behavior for the experimental disk buffer, a configuration issue, or a known limitation/bug in WAL recovery after an unclean shutdown?
Specifically: can the disk buffer normally survive a sudden power loss and replay completed WAL writes after reboot, or is crash-consistency not guaranteed?
Source: influxdata/telegraf