# How to specify logstash config file when running it as a service

**URL:** <https://discuss.elastic.co/t/how-to-specify-logstash-config-file-when-running-it-as-a-service/178266>\
**Category:** Logstash\
**Created:** [April 24, 2019, 1:55pm UTC](https://discuss.elastic.co/t/how-to-specify-logstash-config-file-when-running-it-as-a-service/178266 "2019-04-24T13:55:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mick\_O\_Gorman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mick_o_gorman/32/42021_2.png) [@Mick\_O\_Gorman](https://discuss.elastic.co/u/Mick_O_Gorman)\
**Post date:** [April 24, 2019, 1:55pm UTC](https://discuss.elastic.co/t/how-to-specify-logstash-config-file-when-running-it-as-a-service/178266/1 "2019-04-24T13:55:43Z")

</div>

I can use logstash with the binaries by specifying the config file like this

./logstash -f ../config/logstash-sample.conf`

But when it is installed rather than using the binaries it seems their site says you start logstash as a service like this

sudo initctl start logstash

How can I start it as a service and specify the same config file I would use if i were using the binaries.

something like this although this command doesn't work

sudo initctl start logstash -f logstash-simple.conf

Thanks

---

<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:** [April 24, 2019, 2:44pm UTC](https://discuss.elastic.co/t/how-to-specify-logstash-config-file-when-running-it-as-a-service/178266/2 "2019-04-24T14:44:45Z")

</div>

Use path.config in your logstash.yml. It can be a file rather than a directory.

---

<div class="post-metadata">

**Author:** ![Mick\_O\_Gorman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mick_o_gorman/32/42021_2.png) [@Mick\_O\_Gorman](https://discuss.elastic.co/u/Mick_O_Gorman)\
**Post date:** [April 25, 2019, 8:17am UTC](https://discuss.elastic.co/t/how-to-specify-logstash-config-file-when-running-it-as-a-service/178266/3 "2019-04-25T08:17:19Z")

</div>

This worked for me thanks a lot

---

<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:** [May 23, 2019, 8:17am UTC](https://discuss.elastic.co/t/how-to-specify-logstash-config-file-when-running-it-as-a-service/178266/4 "2019-05-23T08:17:20Z")

</div>

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