# Want to run ruby filter external script from command line

**URL:** <https://discuss.elastic.co/t/want-to-run-ruby-filter-external-script-from-command-line/168303>\
**Category:** Logstash\
**Created:** [February 13, 2019, 10:24pm UTC](https://discuss.elastic.co/t/want-to-run-ruby-filter-external-script-from-command-line/168303 "2019-02-13T22:24:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandondash](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@brandondash](https://discuss.elastic.co/u/brandondash)\
**Post date:** [February 13, 2019, 10:24pm UTC](https://discuss.elastic.co/t/want-to-run-ruby-filter-external-script-from-command-line/168303/1 "2019-02-13T22:24:01Z")

</div>

I use the LogStash::Event object in my script. It all goes great until I try to run it outside of a running Logstash instance. I get a huge set of errors while trying to load the libraries and I can't seem to untangle the huge interconnected dependency mess.

Is there a quick/easy way to get Logstash gems included when running a ruby script on its own?

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [February 15, 2019, 8:17pm UTC](https://discuss.elastic.co/t/want-to-run-ruby-filter-external-script-from-command-line/168303/2 "2019-02-15T20:17:31Z")

</div>

No. Logstash isn't pure Ruby, and it is not possible to load portions of it without also requiring all of the interconnected JRuby/jvm/java bits.

If your script is to be used in both places, the `LogStash::Event#to_hash` or `LogStash::Event#to_hash_with_metadata` can be used to extract the contents of the event into a plain `Hash`.

---

<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:** [March 15, 2019, 8:17pm UTC](https://discuss.elastic.co/t/want-to-run-ruby-filter-external-script-from-command-line/168303/3 "2019-03-15T20:17:40Z")

</div>

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