Search code examples
open-telemetrydistributed-tracingopen-telemetry-collectorotelgrafana-tempo

Running OTEL agent as windows service is not working


Want to run Otel collecor agent as Windows services. So downloaded latest windows release package and run the following command to create service and start the service.

> sc.exe create otelcol displayname= otelcol start= delayed-auto
> binPath=
> "C:\Users\admin\otelcol-contrib_0.94.0_windows_386\otelcol-contrib.exe
> --config C:\Users\admin\Core-Otel.yaml" sc.exe start otelcol

but the service is not started and resulted with error on event viewer as

"The otelcol service terminated with the following error: An exception occurred in the service when handling the control request."

Agent version: 0.94.0 OS: Windows 11

Could any one point the right direction to deploy the Otel agent as windows service ?


Solution

  • In the Windows Desktop, event viewer shows as "Incorrect function." in the general tab. But in the details tab, it is showing as "info [email protected]/service.go:177 Everything is ready. Begin running and processing data" and now able to run as windows service.

    Command used:

    sc.exe create otelcol displayname= otelcol start= delayed-auto
    binPath=
    \""C:\Users\admin\otelcol-contrib_0.94.0_windows_386\otelcol-contrib.exe\"
     --config \"C:\Users\admin\Core-Otel.yaml\"" 
    sc.exe description "Otelcol"
    sc.exe start otelcol
    

    Note: Need to use quotes for path if folder name contains spaces.