Trying to install logstash as windows service. All works when i manually run it from CMD like so:
C:\Elastic\Logstash\bin\logstash -f c:\Elastic\Logstash\config\logstash-sample.conf
I see that file changes are updated and posted to console (per .conf file console output)
However, when i install Logstash as windows service:
sc create Logstash binpath="\"C:\Elastic\Logstash\bin\logstash\" -f \"c:\Elastic\Logstash\config\logstash-sample.conf\""
It creates windows service but will fail when starting it:
Logstash log:
[2019-04-15T14:40:29,605][ERROR][org.logstash.Logstash ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit
When I try to install logstash with NSSM like below, it runs, but does not work:
nssm.exe install logstash "C:\Elastic\Logstash\bin\logstash.bat" "agent -f C:\Elastic\Logstash\config\logstash-sample.conf"
Found the solution: The problem I was having is due to "agent" keyword. In CMD i ran this:
nssm edit logstash