# Setup Filebeat to run as a service

**URL:** <https://discuss.elastic.co/t/setup-filebeat-to-run-as-a-service/292726>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [December 22, 2021, 5:26pm UTC](https://discuss.elastic.co/t/setup-filebeat-to-run-as-a-service/292726 "2021-12-22T17:26:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vharabor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vharabor/32/86659_2.png) [@vharabor](https://discuss.elastic.co/u/vharabor)\
**Post date:** [December 22, 2021, 5:26pm UTC](https://discuss.elastic.co/t/setup-filebeat-to-run-as-a-service/292726/1 "2021-12-22T17:26:02Z")

</div>

I've setup Filebeat on AWS Amazon Linux 2 AMI using the setup instruction here : ([Filebeat quick start: installation and configuration | Filebeat Reference [7.16] | Elastic](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation-configuration.html))

So basically :  
curl -L -O [https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.16.2-linux-x86\_64.tar.gz](https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.16.2-linux-x86_64.tar.gz)  
tar xzvf filebeat-7.16.2-linux-x86\_64.tar.gz

To start filebeat per instructions use:  
sudo ./filebeat -e

That is not running as a service or in the background so if you get out of that SSH session filebeat stops parsing the logs.  
For DEB or RPM you can use sudo service filebeat start , but that does not work for aws linux ami.

How do you setup filebeat to run as a service for aws linux ?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [December 22, 2021, 6:41pm UTC](https://discuss.elastic.co/t/setup-filebeat-to-run-as-a-service/292726/2 "2021-12-22T18:41:15Z")

</div>

You will need to create a service file manually, maybe this [tutorial](https://www.linode.com/docs/guides/start-service-at-boot/) can help with that.

> For DEB or RPM you can use sudo service filebeat start , but that does not work for aws linux ami.

Have you tried? Amazon Linux is a [rpm based](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-software.html) system, so you should be able to install filebeat using the RPM distribution without any problem, this would create the service file for you.

---

<div class="post-metadata">

**Author:** ![vharabor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vharabor/32/86659_2.png) [@vharabor](https://discuss.elastic.co/u/vharabor)\
**Post date:** [December 22, 2021, 8:25pm UTC](https://discuss.elastic.co/t/setup-filebeat-to-run-as-a-service/292726/3 "2021-12-22T20:25:40Z")

</div>

I reinstalled using the suggested rpm install instructions. All good now.  
thanks for your help!

---

<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:** [January 19, 2022, 10:26pm UTC](https://discuss.elastic.co/t/setup-filebeat-to-run-as-a-service/292726/4 "2022-01-19T22:26:29Z")

</div>

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