# Logstash automatically loading the config file

**URL:** <https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790>\
**Category:** Logstash\
**Created:** [November 20, 2019, 11:30pm UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790 "2019-11-20T23:30:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avinaba\_Ghosh\_Hajra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avinaba_ghosh_hajra/32/57697_2.png) [@Avinaba\_Ghosh\_Hajra](https://discuss.elastic.co/u/Avinaba_Ghosh_Hajra)\
**Post date:** [November 20, 2019, 11:30pm UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/1 "2019-11-20T23:30:59Z")

</div>

Logstash is running via systemctl. It is loading the configuration file automatically after certain interval.So the Configuration file which contains an SQL query is loaded multiple times. JDBC plugin does not contain any schedule parameter.  
I want my configuration file will be run only one time.(It will fetch all the data from database table and store it to elasticsearch).  
What should I put in logstash.yml so that it will run once

---

<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:** [November 21, 2019, 12:58am UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/2 "2019-11-21T00:58:00Z")

</div>

If you want to run logstash exactly once, why use systemctl. Why not just run it on the command line?

---

<div class="post-metadata">

**Author:** ![Avinaba\_Ghosh\_Hajra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avinaba_ghosh_hajra/32/57697_2.png) [@Avinaba\_Ghosh\_Hajra](https://discuss.elastic.co/u/Avinaba_Ghosh_Hajra)\
**Post date:** [November 21, 2019, 7:08am UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/3 "2019-11-21T07:08:50Z")

</div>

All the pipeline are running on same configuration.

Regards  
Avinaba

---

<div class="post-metadata">

**Author:** ![fbaligand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fbaligand/32/5657_2.png) [@fbaligand](https://discuss.elastic.co/u/fbaligand)\
**Post date:** [November 21, 2019, 7:43am UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/4 "2019-11-21T07:43:12Z")

</div>

I agree with @Badger.  
If you want the pipeline to be run once, use Logstash as a batch, not like a service always started.

---

<div class="post-metadata">

**Author:** ![Avinaba\_Ghosh\_Hajra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avinaba_ghosh_hajra/32/57697_2.png) [@Avinaba\_Ghosh\_Hajra](https://discuss.elastic.co/u/Avinaba_Ghosh_Hajra)\
**Post date:** [November 21, 2019, 7:49am UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/5 "2019-11-21T07:49:02Z")

</div>

If i run from the command line logs are printing on the console.i want logs are getting printed on a log file. How to achieve this while running from console.

Regards  
Avinaba

---

<div class="post-metadata">

**Author:** ![logger](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@logger](https://discuss.elastic.co/u/logger)\
**Post date:** [November 21, 2019, 8:19am UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/6 "2019-11-21T08:19:39Z")

</div>

you have a few flags you can set. Like `-l, --path.logs PATH Directory to write Logstash internal logs to.`

you can find all of them here: `https://www.elastic.co/guide/en/logstash/current/running-logstash-command-line.html`  
there you can modify all you want.

Greetings  
Malte

---

<div class="post-metadata">

**Author:** ![Avinaba\_Ghosh\_Hajra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avinaba_ghosh_hajra/32/57697_2.png) [@Avinaba\_Ghosh\_Hajra](https://discuss.elastic.co/u/Avinaba_Ghosh_Hajra)\
**Post date:** [November 21, 2019, 8:22am UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/7 "2019-11-21T08:22:33Z")

</div>

Need logstash config file to run with the configurations mentioned in pipeline.yml and logstash.yml

---

<div class="post-metadata">

**Author:** ![logger](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@logger](https://discuss.elastic.co/u/logger)\
**Post date:** [November 21, 2019, 8:26am UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/8 "2019-11-21T08:26:21Z")

</div>

**`--path.settings SETTINGS_DIR`**

Set the directory containing the `logstash.yml` [settings file](https://www.elastic.co/guide/en/logstash/current/logstash-settings-file.html) as well as the log4j logging configuration. This can also be set through the LS\_SETTINGS\_DIR environment variable. The default is the `config` directory under Logstash home.

In this directory you have also your pipeline.yml file

---

<div class="post-metadata">

**Author:** ![fbaligand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fbaligand/32/5657_2.png) [@fbaligand](https://discuss.elastic.co/u/fbaligand)\
**Post date:** [November 21, 2019, 9:06am UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/9 "2019-11-21T09:06:11Z")

</div>

If you need both "run once" database loading and "continuous" log loading, I advice you to have 2 separate Logstash instances.  
The first one is run once as a batch when you want. So when processing is finished, Logstash stops.  
The second one is run as a server to continuously stream log processing.

---

<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:** [December 19, 2019, 9:11am UTC](https://discuss.elastic.co/t/logstash-automatically-loading-the-config-file/208790/10 "2019-12-19T09:11:16Z")

</div>

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