# Run logstash as service giving error

**URL:** <https://discuss.elastic.co/t/run-logstash-as-service-giving-error/240461>\
**Category:** Logstash\
**Created:** [July 9, 2020, 7:03am UTC](https://discuss.elastic.co/t/run-logstash-as-service-giving-error/240461 "2020-07-09T07:03:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohitarorait82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohitarorait82/32/82981_2.png) [@rohitarorait82](https://discuss.elastic.co/u/rohitarorait82)\
**Post date:** [July 9, 2020, 7:03am UTC](https://discuss.elastic.co/t/run-logstash-as-service-giving-error/240461/1 "2020-07-09T07:03:03Z")

</div>

Hi All,

I am able to run logstash as command line , but when I try to run it as a services . It is getting restarted after every 6 seconds and no data is getting loaded to elasticsearch

I have placed my conf file in etc/logstash/conf.d folder  
with datapower.conf name

I am getting below error :  
Logstash - java.lang.IllegalStateException: Logstash stopp...dev/null

---

<div class="post-metadata">

**Author:** ![rohitarorait82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohitarorait82/32/82981_2.png) [@rohitarorait82](https://discuss.elastic.co/u/rohitarorait82)\
**Post date:** [July 10, 2020, 12:23pm UTC](https://discuss.elastic.co/t/run-logstash-as-service-giving-error/240461/2 "2020-07-10T12:23:12Z")

</div>

Hi All,

I am new to ELK stack and got stuck with running logstash as a service.

Logstash is working fine using **./logstash** command from below path

**/usr/share/logstash/bin**

However it is not working with **systemctl start logstash**. Can anyone please help on this.

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [July 10, 2020, 1:40pm UTC](https://discuss.elastic.co/t/run-logstash-as-service-giving-error/240461/3 "2020-07-10T13:40:23Z")

</div>

post any log messages you are having

---

<div class="post-metadata">

**Author:** ![rohitarorait82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohitarorait82/32/82981_2.png) [@rohitarorait82](https://discuss.elastic.co/u/rohitarorait82)\
**Post date:** [July 10, 2020, 2:03pm UTC](https://discuss.elastic.co/t/run-logstash-as-service-giving-error/240461/4 "2020-07-10T14:03:48Z")

</div>

@elasticforme :

I can see below error while checking status

_[root@ndc3vmappelk01 ~]# systemctl status logstash -l_  
_● logstash.service - logstash_

- Loaded: loaded (/etc/systemd/system/logstash.service; disabled; vendor preset: disabled)\*
- Active: activating (auto-restart) (Result: exit-code) since Fri 2020-07-10 19:32:34 IST; 2ms ago\*
- Process: 104656 ExecStart=/usr/share/logstash/bin/logstash --path.settings /etc/logstash (code=exited, status=1/FAILURE)\*
- Main PID: 104656 (code=exited, status=1/FAILURE)\*

_Jul 10 19:32:34 IP systemd[1]: Unit logstash.service entered failed state._  
_Jul 10 19:32:34 IP systemd[1]: logstash.service failed._

Actually, it keeps on restarting and I can see permission denied sometimes

When I check the status after stopping the service. I can see below details

_[root@IP bin]# systemctl status logstash -l_  
_● logstash.service - logstash_

- Loaded: loaded (/etc/systemd/system/logstash.service; disabled; vendor preset: disabled)\*
- Active: inactive (dead)\*

_Jul 10 19:58:53 IP systemd[1]: Unit logstash.service entered failed state._  
_Jul 10 19:58:53 IP systemd[1]: logstash.service failed._  
_Jul 10 19:58:53 IP systemd[1]: logstash.service holdoff time over, scheduling restart._  
_Jul 10 19:58:53 IP systemd[1]: Stopped logstash._  
_Jul 10 19:58:53 IP systemd[1]: Started logstash._  
_Jul 10 19:59:01 IP logstash[114314]: [ERROR] 2020-07-10 19:59:00.998 [main] Logstash - java.lang.IllegalStateException: Logstash stopped processing because of an error: (EACCES) Permission denied - /dev/null_  
_Jul 10 19:59:01 IP systemd[1]: logstash.service: main process exited, code=exited, status=1/FAILURE_  
_Jul 10 19:59:01 IP systemd[1]: Unit logstash.service entered failed state._  
_Jul 10 19:59:01 IP systemd[1]: logstash.service failed._  
_Jul 10 19:59:01 IP systemd[1]: Stopped logstash._  
_[root@IP bin]#_

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [July 10, 2020, 5:28pm UTC](https://discuss.elastic.co/t/run-logstash-as-service-giving-error/240461/5 "2020-07-10T17:28:28Z")

</div>

is this the same error in your log file? if you have not change log file then it will be in /var/log/logstash

---

<div class="post-metadata">

**Author:** ![ptamba](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@ptamba](https://discuss.elastic.co/u/ptamba)\
**Post date:** [July 12, 2020, 6:17am UTC](https://discuss.elastic.co/t/run-logstash-as-service-giving-error/240461/6 "2020-07-12T06:17:42Z")

</div>

> [@rohitarorait82](#):
>
> Jul 10 19:59:01 IP logstash[114314]: [ERROR] 2020-07-10 19:59:00.998 [main] Logstash - java.lang.IllegalStateException: Logstash stopped processing because of an error: (EACCES) Permission denied - /dev/null

looks like you’re using /dev/null somewhere in your config(maybe your pipeline?). if you run logstash cli as root, root will have access to /dev/null , but logstash from systemctl by default will be run as logstash user, and it doesn’t have write access to /dev/null

---

<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:** [August 9, 2020, 6:17am UTC](https://discuss.elastic.co/t/run-logstash-as-service-giving-error/240461/7 "2020-08-09T06:17:43Z")

</div>

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