Install logstash as a service via Powershell


(Pedrovac The Hell) #1

Hello. I have a problem. I'm trying to install Logstash as a service in Windows OS via Powershell.
I have run.bat file to start logstash:

logstash.bat agent -f logstash.conf

My PS command looks like:

New-Service -Name Logstash -BinaryPathName "C:\Windows\system32\cmd.exe /c C:\ELK\logstash\bin\run.bat" -DisplayName "Logstash" -Description "Test Logstash service".

But services.msc throws an error 1053. But if I use NSSM for that I have no errors and everything is ok. How to fix that?


(Mark Walkom) #2

Where did you get the PS script from?


(Pedrovac The Hell) #3

@warkolm I have written it based on Microsoft's documentation about PowerShell New-Service function. https://technet.microsoft.com/en-us/library/hh849830.aspx


(system) #4