Facing issues when configuring Alloy for Windows on AWS EC2 instance

Hi there!

I have been trying to install and configure alloy in AWS EC2 Windows instance machine but got into few issues and have some questions.

Background: The alloy installed at below directory and has following files:

Directory: C:\Program Files\GrafanaLabs\Alloy

%PROGRAMDATA%
data-alloy
alloy-service-windows-amd64.exe
alloy-windows-amd64.exe
config.alloy
logo.ico
uninstall.exe

When I navigate to directory C:\Program Files\GrafanaLabs\Alloy and execute command ./alloy-windows-amd64.exe run C:\tmp\grafana-alloy.hcl the alloy runs fine and able to push the loki logs into grafana.

Note: grafana-alloy.hcl is my converted alloy file from Static agent.

However, I want to automate the process, and below commands does not write any logs.

Start-Process -FilePath “C:\Program Files\GrafanaLabs\Alloy\alloy-service-windows-amd64.exe”

sc.exe config ‘Alloy’ binPath= ‘"C:\Program Files\GrafanaLabs\Alloy\alloy-service-windows-amd64.exe" "-config.file=C:\tmp\grafana-alloy.hcl"’

Start-Service ‘Alloy’ - No errors but logged are not pushed.

Questions:

  1. What is alloy-service-windows-amd64.exe file used for? How it is different from alloy-windows-amd64.exe.
  2. What should be the binPath?
  3. ./alloy-service-windows-amd64.exe --help does not return anything. However, ./alloy-windows-amd64.exe --help does run alloy commands.

alloy-service-windows-amd64.exe is the windows service wrapper, you can find the details for it in the registry.

alloy-windows-amd64.exe is the actual alloy binary.

I install everything grafana in a folder called C:\LGTM

then for alloy I use nssm to install it with this parameter