Hi there all. Sorry if this has been answered elsewhere, but I have not been able to find any solution to this in the Community or web. Does anyone know how I can run Loki and Promtail as Windows services?
There no specific configuration, you can create as a simple Windows service based on the executable.
sc.exe create <new_service_name> binPath= "<path_to_the_service_executable>"
Thanks for your reply. From my investigation, you can’t create a service with sc for any executable, and I was unable to create one for Loki and Promtail with sc and actually start it.
I have tried a few service wrappers to get around it and have found one that works well: Winsw (GitHub - winsw/winsw: A wrapper executable that can run any executable as a Windows service, in a permissive license.)
You can use nssm.exe and create loki and promtail as a service like below
1.Download nssm.exe and unzip the nssm.exe
2.Open windows shell as administrator and then navigate to the nssm.exe directory and type the below command
.\nssm.exe install loki
Which will open a GUI like below
Make sure both the binary and config file remain in same directory now save it as a service and then start the service
Similarly do it for promtail
This is best and i am using the same.