# Run logstash command on in the background on ec2

**URL:** <https://discuss.elastic.co/t/run-logstash-command-on-in-the-background-on-ec2/185514>\
**Category:** Logstash\
**Created:** [June 12, 2019, 9:01pm UTC](https://discuss.elastic.co/t/run-logstash-command-on-in-the-background-on-ec2/185514 "2019-06-12T21:01:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohit\_Ruke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohit_ruke/32/46323_2.png) [@Mohit\_Ruke](https://discuss.elastic.co/u/Mohit_Ruke)\
**Post date:** [June 12, 2019, 9:01pm UTC](https://discuss.elastic.co/t/run-logstash-command-on-in-the-background-on-ec2/185514/1 "2019-06-12T21:01:24Z")

</div>

Hi Everyone,

I am currently trying to dump all my data from s3 to Elasticsearch.

I run this from ec2.

for that I have my logstash config file at /etc/logstash/conf.d/awses.conf

I run the command /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/awses.conf and any new files that land in ec2 are indexed in Elasticsearch  
But as soon as the ssh window terminates this stops.  
I want to keep this command running all the time in the background.

Any suggestion on how to achieve this?

Thank You,  
Mohit Ruke

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [June 12, 2019, 11:30pm UTC](https://discuss.elastic.co/t/run-logstash-command-on-in-the-background-on-ec2/185514/2 "2019-06-12T23:30:18Z")

</div>

you'll want to run logstash as a service, which depends on which OS you're running.

See: [https://www.elastic.co/guide/en/logstash/current/running-logstash.html](https://www.elastic.co/guide/en/logstash/current/running-logstash.html)

---

<div class="post-metadata">

**Author:** ![Mohit\_Ruke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohit_ruke/32/46323_2.png) [@Mohit\_Ruke](https://discuss.elastic.co/u/Mohit_Ruke)\
**Post date:** [June 13, 2019, 3:03am UTC](https://discuss.elastic.co/t/run-logstash-command-on-in-the-background-on-ec2/185514/3 "2019-06-13T03:03:31Z")

</div>

I am using Linux OS on AWS EC2

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [June 13, 2019, 9:25pm UTC](https://discuss.elastic.co/t/run-logstash-command-on-in-the-background-on-ec2/185514/4 "2019-06-13T21:25:23Z")

</div>

You'll need to figure out how that OS manages services (e.g., initd, systemd, upstart, etc)., and use the previously-linked guide to match that up with the required Logstash configuration.

---

<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:** [July 11, 2019, 9:25pm UTC](https://discuss.elastic.co/t/run-logstash-command-on-in-the-background-on-ec2/185514/5 "2019-07-11T21:25:25Z")

</div>

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