Writing to CSV file with headers and rotation

MAndr
Wed, 16 Jul 2025 09:34:00 +0000
Telegraf

Dear sir,
I’m reading from Modbus registers and writing the data every 10 seconds to a csv file.
I set the file rotation to every minute, and it works but something strange happens: the header file disappears (it’s only there for the first file).
Here the configuration

 [[outputs.file]]
  files = ["bb_1/plc_data.csv"]
  data_format = "csv"
  csv_separator = ";"
  csv_header = true
  csv_timestamp_format = "2006-01-02T15:04:05"
  rotation_interval = "1m"
  rotation_max_size = "0MB"
  rotation_max_archives = -1
  [outputs.file.tagpass]
    source = ["bb_1"]

There are several plcs, each with a tag, and that’s why there is the tagpass section, to write files in a folder for each plc.
Thank you,
best regards

1 post - 1 participant