influxdata/telegraf

[inputs.directory_monitor] Preserve original file timestamps (created/updated time) when moving files to "finished_directory"

已關閉

#16,885 建立於 2025年4月27日

 (3 則留言) (1 個反應) (0 位負責人)Go (5,838 個分叉)batch import
feature requesthelp wantedsize/s

倉庫指標

星標
 (17,764 顆星)
PR 合併指標
 (平均合併 2天 12小時) (30 天內合併 136 個 PR)

描述

Use Case

When using the [inputs.directory_monitor] plugin in Telegraf to process files from a directory, it's common to move processed files to a "finished" directory for archiving and tracking purposes. For compliance, auditing, or tracking reasons, it is often important to preserve the original file's created and updated timestamps instead of overwriting them with the current time during the move operation.

Expected behavior

When moving a processed file to the finished directory, the system should preserve the file's original created and updated timestamps. Alternatively, provide a configurable option (e.g., preserve_timestamps = true) for users who want to retain original file metadata during move operations.

Actual behavior

Currently, when a file is processed and moved to the finished directory, its created and updated timestamps are reset to the current time. This causes loss of the original file metadata, making it difficult to trace the actual file history.

Additional info

No response

貢獻者指南