# How can I start logstash from a script

**URL:** <https://discuss.elastic.co/t/how-can-i-start-logstash-from-a-script/277010>\
**Category:** Logstash\
**Created:** [June 25, 2021, 4:53am UTC](https://discuss.elastic.co/t/how-can-i-start-logstash-from-a-script/277010 "2021-06-25T04:53:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mbartlett413](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mbartlett413/32/90814_2.png) [@Mbartlett413](https://discuss.elastic.co/u/Mbartlett413)\
**Post date:** [June 25, 2021, 4:53am UTC](https://discuss.elastic.co/t/how-can-i-start-logstash-from-a-script/277010/1 "2021-06-25T04:53:44Z")

</div>

Background: I have logstash and elasticsearch running on a server. I have a rails application which uploads a CSV to the server and logstash then processes. It works if I manually execute the generated script. If I try to have rails do a system command, I get an error.

Manually call the script from server (WORKS)

`logstash_folder/execute_random.sh`

Rails app system command(ERROR)

`logstash_folder/execute_random.sh`

**Error: WARNING: Could not find logstash.yml which is typically located in $LS\_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults**

execute\_random.sh (script being called)

```auto
#!/bin/bash
sudo systemctl stop logstash
sleep 1
sudo /usr/share/logstash/bin/logstash -f logstash_folder/conf_folder/logstash.conf

```

Looking over this blog [WARNING: Could not find logstash.yml which is typically located in $LS\_HOME/config or /etc/logstash - #15 by MrNerd](https://discuss.elastic.co/t/warning-could-not-find-logstash-yml-which-is-typically-located-in-ls-home-config-or-etc-logstash/131022/15)

I change the script to include `--path.settings

sudo /usr/share/logstash/bin/logstash --path.settings /etc/logstash/ --path.data -f logstash\_folder/#{self.logstash\_index}/#{self.logstash\_index}.conf"

& recieve this error

`ERROR: Unknown command 'logstash_folder/conf_folder/logstash.conf`

OR

````auto
    [INFO][logstash.config.source.local.configpathloader] No config files found in 
    path {:path=>"/logstash_folder/conf_folder/logstash.conf"}
    [ERROR][logstash.config.sourceloader] 
    No configuration found in the configured sources.
```Preformatted text
````

---

<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:** [June 25, 2021, 5:11am UTC](https://discuss.elastic.co/t/how-can-i-start-logstash-from-a-script/277010/2 "2021-06-25T05:11:13Z")

</div>

Where is your config file located? The logstash process is looking for it in the folder `/logstash_folder/conf_folder/logstash.conf`, does this path exists?

How are you running your script manually, from which directory? And from which directory are you running your rails app?

Try to use the full path in your command, use `-f /full/path/to/the/config/file.conf`.

---

<div class="post-metadata">

**Author:** ![Mbartlett413](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mbartlett413/32/90814_2.png) [@Mbartlett413](https://discuss.elastic.co/u/Mbartlett413)\
**Post date:** [June 25, 2021, 5:30am UTC](https://discuss.elastic.co/t/how-can-i-start-logstash-from-a-script/277010/3 "2021-06-25T05:30:51Z")

</div>

Thanks for the quick reply.  
The config file does exist in that directory, it is executed when I run the shell script. I will try giving a full path...  
2nd, as for manual ...inside the shell script mentioned "execute\_random.sh" will execute logstash. so from my unbuntu server I would just run ./logstash\_folder/execute\_random.sh and it processes...

/home/  
user/  
dev/  
lsa-demo/  
logstash\_folder/ \*\*Generated scripts

EDIT### Changed .conf  
WARNING: Could not find logstash.yml which is typically located in $LS\_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults

---

<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 23, 2021, 5:31am UTC](https://discuss.elastic.co/t/how-can-i-start-logstash-from-a-script/277010/4 "2021-07-23T05:31:48Z")

</div>

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