Open nralbers opened 3 years ago
Thanks for the suggestion! Would you be able to develop a PR?
I don't have a Windows environment to test with so I could make something but won't be able to verify it before I commit the code.
I'm not a go developer, but I can easily compile and test a branch to verify the code. I work in infrastructure monitoring so I have a bunch of vagrant test boxes I can validate builds against. So while i'm not in a position to develop a pull request on my own, I can assist in getting one tested.
I'm using mtail on windows servers, and while it's working really well for my use case, automating the deployment and reconfiguration is a nuisance because there aren't many good options for running a process in the background that can be stopped and started to load new configuration. Because windows assumes that you'll use a service for that. While i'm aware that there are wrapper programs available to allow running arbitrary binaries as a windows service, i'm then relying on another third party piece of software with little or no support.
Is it possible to add a register and run as service option to mtail? It appears there are a few go library options for implementing this. See https://www.reddit.com/r/golang/comments/7hr0cx/running_a_go_exe_as_a_windows_service/ for a discussion of possibilities. Also this package: https://pkg.go.dev/golang.org/x/sys/windows/svc?utm_source=godoc
Suggestions: --install-windows-service option to register service. This registers the mtail executable as a service, using the rest of the command line options as service start parameters.