# Service Logstash with exit code 1 when restarting

**URL:** https://discuss.elastic.co/t/service-logstash-with-exit-code-1-when-restarting/194944
**Category:** Logstash
**Created:** [August 13, 2019, 3:06am UTC](https://discuss.elastic.co/t/service-logstash-with-exit-code-1-when-restarting/194944 "2019-08-13T03:06:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![shwesinhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shwesinhan/32/78663_2.png) [@shwesinhan](https://discuss.elastic.co/u/shwesinhan)
#### Post date: [August 13, 2019, 3:06am UTC](https://discuss.elastic.co/t/service-logstash-with-exit-code-1-when-restarting/194944/1 "2019-08-13T03:06:30Z")

</div>

hi community

I need advise from community about logstash  
I create logstash as a service using NSSM in Windows Server 2016.  
Then I usually use(start/stop/restart) it via services panel.

Now I can not restart anymore.  
Let me share the windows event viewer logs.

`D:\elk\logstash-6.1.1\bin\logstash.bat exits. RegisterWaitForSingleObject() failed: The parameter is incorrect.`  
`Killing process tree of process 5404 for service Logstash with exit code 1`  
`Killing PID 5404 in process tree of PID 5404 because service Logstash is stopping.`  
`Program D:\elk\logstash-6.1.1\bin\logstash.bat for service Logstash exited with return code 1.`  
`Started D:\elk\logstash-6.1.1\bin\logstash.bat -f D:\elk\logstash-6.1.1\bin\my-pipeline.conf for service Logstash in D:\elk\logstash-6.1.1\bin.`

When I restart via command prompt, it is fine.  
But I want to use via service. How do I get it back?  
Looking forward to reply...

Thank you.

---

<div class="post-metadata">

### Author: ![shwesinhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shwesinhan/32/78663_2.png) [@shwesinhan](https://discuss.elastic.co/u/shwesinhan)
#### Post date: [August 13, 2019, 6:59am UTC](https://discuss.elastic.co/t/service-logstash-with-exit-code-1-when-restarting/194944/2 "2019-08-13T06:59:18Z")

</div>

Oh I know why now  
It seems jre update.  
When logstash stop and restart again, it becomes JAVA\_HOME variable path is not correct.  
After editing JAVA\_HOME variable, it works properly.

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [August 13, 2019, 1:17pm UTC](https://discuss.elastic.co/t/service-logstash-with-exit-code-1-when-restarting/194944/3 "2019-08-13T13:17:56Z")

</div>

> [@shwesinhan](#):
>
> RegisterWaitForSingleObject() failed: The parameter is incorrect.

That is an NSSM error. It is not clear that logstash has anything to do with this.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 10, 2019, 1:17pm UTC](https://discuss.elastic.co/t/service-logstash-with-exit-code-1-when-restarting/194944/4 "2019-09-10T13:17:58Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
