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?
Hi,
There no specific configuration, you can create as a simple Windows service based on the executable.
Example :
sc.exe create <new_service_name> binPath= "<path_to_the_service_executable>"
Good Luck
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.
Has anyone actually tried that for Promtail, because when I use NSSM for Promtail it will not start the service. Running as a normal process from a cmd works without problems
Yes you can use an executable. I think you’re running into the same problem I had with Telegraf. Don’t use paths with spaces. Do as the following like I did with Telegraf:
C:\Progra~1\telegraf\telegraf.exe --config C:\progra~1\telegraf\conf\telegraf.conf --config-directory C:\Progra~1\telegraf\conf --service-name telegraf