# Logstash Crashing when running via systemctl vs running it on command line

**URL:** <https://discuss.elastic.co/t/logstash-crashing-when-running-via-systemctl-vs-running-it-on-command-line/128263>\
**Category:** Logstash\
**Created:** [April 16, 2018, 11:33pm UTC](https://discuss.elastic.co/t/logstash-crashing-when-running-via-systemctl-vs-running-it-on-command-line/128263 "2018-04-16T23:33:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kseth](https://avatars.discourse-cdn.com/v4/letter/k/e0b2c6/32.png) [@kseth](https://discuss.elastic.co/u/kseth)\
**Post date:** [April 16, 2018, 11:33pm UTC](https://discuss.elastic.co/t/logstash-crashing-when-running-via-systemctl-vs-running-it-on-command-line/128263/1 "2018-04-16T23:33:20Z")

</div>

I have a Logstash process that's running to delete documents from a Elasticsearch index when they are actually updated in the underlying db. It runs fine when I run it via command line like below:  
**sudo /usr/share/logstash/bin/logstash -f qa/pipeline-sql-qa-delete-product.cfg --path.data /tmp/qa/ --config.debug --log.level=debug**

It doesn't work when I am running the same logstash command via systemctl service. The logstash process dies with errors.  
**sudo /usr/share/logstash/bin/logstash --path.config /etc/logstash/conf.d/qa --path.data /tmp/qa/ --path.settings /etc/logstash/qa\_settings\_dir --path.logs /var/log/logstash/qa --config.debug --log.level=debug &**

Information from logs:

> [2018-04-16T22:15:00,772][ERROR][logstash.pipeline] Error registering plugin {:plugin=\>"\<LogStash::Inputs::Jdbc jdbc\_driver\_library=\>"sqljdbc4.jar", jdbc\_driver\_class=\>"com.microsoft.sqlserver.jdbc.SQLServerDriver", jdbc\_connection\_string=\>"jdbc:sqlserver://10.147.4.35:1433;databaseName=www;", jdbc\_user=\>"AppFamily\_CMS", jdbc\_password=\>, schedule=\>"\* \* \* \* _", statement=\>"SELECT p.product\_id, p.lastUpdate as lastupdate FROM product p WHERE pshortdesc = '_'\n GROUP BY p.product\_id, p.lastUpdate\n Having p.lastUpdate \> :sql\_last\_value", type=\>"wwwproducts", use\_column\_value=\>true, tracking\_column=\>"lastupdate", tracking\_column\_type=\>"timestamp", last\_run\_metadata\_path=\>"qa\_wwwproducts\_delete\_last\_run", lowercase\_column\_names=\>true, record\_last\_run=\>true, id=\>"b86745c531739c682cff837d08d0ddbe4a5b32a8-1", enable\_metric=\>true, codec=\>\<LogStash::Codecs::Plain id=\>"plain\_12a91125-fd14-48ed-8e5a-e2c6548405b7", enable\_metric=\>true, charset=\>"UTF-8"\>, jdbc\_paging\_enabled=\>false, jdbc\_page\_size=\>100000, jdbc\_validate\_connection=\>false, jdbc\_validation\_timeout=\>3600, jdbc\_pool\_timeout=\>5, sql\_log\_level=\>"info", connection\_retry\_attempts=\>1, connection\_retry\_attempts\_wait\_time=\>0.5, clean\_run=\>false\>", :error=\>"uninitialized constant ThreadSafe::JRubyCacheBackend"}

> [2018-04-16T22:15:06,993][ERROR][logstash.agent] Pipeline aborted due to error {:exception=\>#\<NameError: uninitialized constant ThreadSafe::JRubyCacheBackend\>, :backtrace=\>["org/jruby/RubyModule.java:2746:in `const_missing'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/thread_safe-0.3.6-java/lib/thread_safe/cache.rb:12:in `ThreadSafe'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/thread\_safe-0.3.6-java/lib/thread\_safe/cache.rb:3:in `(root)'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/tzinfo-1.2.4/lib/tzinfo/timezone.rb:1:in `(root)'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/tzinfo-1.2.4/lib/tzinfo/timezone.rb:649:in `init_loaded_zones'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/tzinfo-1.2.4/lib/tzinfo/timezone.rb:651:in `Timezone'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/tzinfo-1.2.4/lib/tzinfo/timezone.rb:46:in `TZInfo'", "org/jruby/RubyKernel.java:1040:in `require'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/tzinfo-1.2.4/lib/tzinfo/timezone.rb:5:in `(root)'", "org/jruby/RubyKernel.java:1040:in `require'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/tzinfo-1.2.4/lib/tzinfo.rb:1:in `(root)'", "org/jruby/RubyKernel.java:1040:in `require'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/tzinfo-1.2.4/lib/tzinfo.rb:28:in `(root)'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler.rb:1:in `(root)'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler.rb:28:in `(root)'", "org/jruby/RubyArray.java:1613:in `each'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.3.1/lib/logstash/inputs/jdbc.rb:1:in `(root)'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.3.1/lib/logstash/inputs/jdbc.rb:206:in `register'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:281:in `register\_plugin'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:292:in `register_plugins'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:292:in `register\_plugins'"]}

Is there a reason why this is failing even though both are same commands and one works fine it ran on command line whereas other ran as a service errors out?

Adding the output part of the configuration file below:

> output {  
> if [type] == "wwwproducts" {  
> elasticsearch {  
> hosts =\> ["[https://search-pcms-es-dev-jrnes5bars2m6famzbk446d67m.us-west-2.es.amazonaws.com:443](https://search-pcms-es-dev-jrnes5bars2m6famzbk446d67m.us-west-2.es.amazonaws.com:443)" ]  
> index =\> "allproductsdev"  
> document\_id =\> "%{product\_id}"  
> action =\> "delete"  
> }  
> }  
> }

---

<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 17, 2018, 12:22am UTC](https://discuss.elastic.co/t/logstash-crashing-when-running-via-systemctl-vs-running-it-on-command-line/128263/2 "2018-04-17T00:22:38Z")

</div>

> [@kseth](#):
>
> schedule=\>"\* \* \* \* ",

The stack trace on the 'Pipeline aborted due to error' suggest the rufus scheduler has an issue finding the timezone. Can you post/confirm exactly what that schedule option looks like on the input? Should it be 5 \*'s rather than 4?

---

<div class="post-metadata">

**Author:** ![kseth](https://avatars.discourse-cdn.com/v4/letter/k/e0b2c6/32.png) [@kseth](https://discuss.elastic.co/u/kseth)\
**Post date:** [April 17, 2018, 5:30pm UTC](https://discuss.elastic.co/t/logstash-crashing-when-running-via-systemctl-vs-running-it-on-command-line/128263/3 "2018-04-17T17:30:17Z")

</div>

Thanks for pointing it out, that seems to be the issue!

---

<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 15, 2018, 5:30pm UTC](https://discuss.elastic.co/t/logstash-crashing-when-running-via-systemctl-vs-running-it-on-command-line/128263/4 "2018-05-15T17:30:33Z")

</div>

Closed on May 15, 2018, 5:30pm UTC

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