Telegraf Tail - can't delete large Tail file while Telegraf is running


I have an app on Windows 7 that gathers data from a variety of hardware for months and writes to InfluxDB. Short of writing a Go plugin, it looks like Tail and Exec are my options. When the Tail file gets big I want to delete it and start an empty file of same name.

My code works when Telegraf is not running, but when it is running, Delete function returns with no error, but I get some “file permissions” error when trying to create a file of the same name. The old file stays visible in Windoze until I stop the Telegraf service.

Is deleting the Tail file not allowed by Telegraf? Any other ways to handle a big Tail file? Thanks for any ideas, etc.
Chris C.

Hi Chris , welcome !

is this powershell solution something you can use ?

Clear-Content cmdlet

best regards

Thanks, yes, I was thinking about this sort of soon. but didn’t know how. Will try.