-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Component(s)
receiver/filelog
Is your feature request related to a problem? Please describe.
On Windows, files open by the collector cannot be moved/deleted. It would be nice if the collector opened a file with the FILE_SHARE_DELETE share mode
Describe the solution you'd like
When opening files on Windows, with the CreateFile(W|A) function (docs here), a share mode is passed in that dictates how other processes may access this file.
The documentation calls out 3 values that may be combined, "FILE_SHARE_DELETE", "FILE_SHARE_READ", and "FILE_SHARE_WRITE". In Go's default os.Open implementation, "FILE_SHARE_READ|FILE_SHARE_WRITE" is used as this parameter, but having "FILE_SHARE_DELETE" would be useful, because it would allow other processes to delete or rename the file without having to shut down the collector.
It should be possible to construct a file handle using the CreateFile syscall, and turn it into an os.File by using syscall.CreateFile to create the handle, then wrap it using windows.NewFile (the fd here is not of type syscall.Handle, but the implementation is clear that fd should be a handle)
Describe alternatives you've considered
No response
Additional context
No response