Feature request: truncate / over-write files rather than append - configurable option #22308
Labels
sink: file
Anything `file` sink related
type: feature
A value-adding code addition that introduce new functionality.
A note for the community
Use Cases
We frequently want to read files that are outputs of Vector, though we have aggregations that are once per (minute, hour, multiple hours) in duration. Currently, we use a shell script to grab a wildcard version of the filename, rename it or move it, and put it somewhere so that other tools don't have to parse wildcards or deal with multiple names. It seems like this could easily be worked around with Vector if there was some way to truncate (over-write) a file. I dislike having to run shell scripts to do "clean-up" on concepts that I think could be done by the originating application instead.
Attempted Solutions
I've used shell scripts and crontabs and logrotate. Ugh.
Proposal
The idea: add two features to the "file" sink.
truncate_after_closetime: - this would over-write the contents of the file, assuming the name was the same at the moment of decision as when the file was created, if the file had been closed for more than a certain number of seconds. This would work in conjunction with idle_timeout_secs which would close the file after a certain number of seconds.
truncate_after_modifiedtime: - this would over-write the contents of a file, assuming the name was the same at the moment of decision as when the file was created, if the file modification was more than a certain number of seconds in the past. If the file was open, close it before truncating. This is very similar to truncate_after_closetime, but slightly different. It may be that only one of the two options is needed to start.
References
No response
Version
vector 0.44.0 (x86_64-unknown-linux-gnu)
The text was updated successfully, but these errors were encountered: