# Logstash to run in background services in Windows

**URL:** <https://discuss.elastic.co/t/logstash-to-run-in-background-services-in-windows/123604>\
**Category:** Logstash\
**Created:** [March 12, 2018, 5:36pm UTC](https://discuss.elastic.co/t/logstash-to-run-in-background-services-in-windows/123604 "2018-03-12T17:36:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vaishali1](https://avatars.discourse-cdn.com/v4/letter/v/f05b48/32.png) [@vaishali1](https://discuss.elastic.co/u/vaishali1)\
**Post date:** [March 12, 2018, 5:36pm UTC](https://discuss.elastic.co/t/logstash-to-run-in-background-services-in-windows/123604/1 "2018-03-12T17:36:13Z")

</div>

How to run the logstash automatically "Services" in Windows, once when the system restarted?

---

<div class="post-metadata">

**Author:** ![richl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richl/32/28946_2.png) [@richl](https://discuss.elastic.co/u/richl)\
**Post date:** [March 13, 2018, 12:30pm UTC](https://discuss.elastic.co/t/logstash-to-run-in-background-services-in-windows/123604/2 "2018-03-13T12:30:49Z")

</div>

To accomplish this, I installed NSSM first on the system I wanted the service to run from. NSSM which is Non-Sucking Service Manager is an application to help you create services.

After installing it I ran the following command using PowerShell:  
Invoke-Expression –command “c:\ ELK\nssm\win64\nssm install Logstash”

Once NSSM opens you'll need to set the Path, Startup directory, and the Arguments. Below is what i use on my nodes.

_Path: c:\ELK\logstash\bin\logstash.bat_  
_Startup directory: c:\ELK\logstash\bin_  
_Arguments: -f c:\ELK\logstash\bin\logstash.conf_

You can edit the details such as display name and description under details tab as well as other settings and you should be good to go.

---

<div class="post-metadata">

**Author:** ![vaishali1](https://avatars.discourse-cdn.com/v4/letter/v/f05b48/32.png) [@vaishali1](https://discuss.elastic.co/u/vaishali1)\
**Post date:** [March 13, 2018, 1:46pm UTC](https://discuss.elastic.co/t/logstash-to-run-in-background-services-in-windows/123604/3 "2018-03-13T13:46:50Z")

</div>

Thank you.

---

<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:** [April 10, 2018, 1:47pm UTC](https://discuss.elastic.co/t/logstash-to-run-in-background-services-in-windows/123604/4 "2018-04-10T13:47:03Z")

</div>

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