# How to install logstash ruby filer plugin

**URL:** <https://discuss.elastic.co/t/how-to-install-logstash-ruby-filer-plugin/125600>\
**Category:** Logstash\
**Created:** [March 26, 2018, 12:41pm UTC](https://discuss.elastic.co/t/how-to-install-logstash-ruby-filer-plugin/125600 "2018-03-26T12:41:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![csudaya](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@csudaya](https://discuss.elastic.co/u/csudaya)\
**Post date:** [March 26, 2018, 12:41pm UTC](https://discuss.elastic.co/t/how-to-install-logstash-ruby-filer-plugin/125600/1 "2018-03-26T12:41:44Z")

</div>

I am trying to execute a workflow in pnda using logstash.

The config file has ruby inline code and I understand we need to have plugin.

can you please tell me on how to install thesame

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 26, 2018, 12:51pm UTC](https://discuss.elastic.co/t/how-to-install-logstash-ruby-filer-plugin/125600/2 "2018-03-26T12:51:36Z")

</div>

Are you sure you don't already have the ruby plugin? The page below describes how to list the plugins you have as well as how to install new ones.

[https://www.elastic.co/guide/en/logstash/current/working-with-plugins.html](https://www.elastic.co/guide/en/logstash/current/working-with-plugins.html)

---

<div class="post-metadata">

**Author:** ![csudaya](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@csudaya](https://discuss.elastic.co/u/csudaya)\
**Post date:** [March 26, 2018, 1:04pm UTC](https://discuss.elastic.co/t/how-to-install-logstash-ruby-filer-plugin/125600/3 "2018-03-26T13:04:11Z")

</div>

Thanks Magnus for your kind help. I was able to successfully install with logstash\_plugin install logstash-ruby-filter and it is getting listed too.

However , I get this exception when I try to run the logstash, Please find below the config file

[2018-03-26T12:56:29,980][ERROR][logstash.agent] Failed to execute action {:action=\>LogStash::PipelineAction::Crea te/pipeline\_id:main, :exception=\>"LogStash::ConfigurationError", :message=\>"Expected one of #, =\> at line 14, column 18 (byte 392) after filter {\n mutate {\n add\_field =\> {\n "host\_ip" =\> "localhost" # change the IP and set something meaningful\n }\n rename =\> { "message" =\> "rawdata" } # Put the content of th e message to the PNDA Avro 'rawdata' field\n ruby ", :backtrace=\>["/opt/pnda/logstash-6.2.3/logstash-core/lib/logs tash/compiler.rb:42:in `compile_imperative'", "/opt/pnda/logstash-6.2.3/logstash-core/lib/logstash/compiler.rb:50:in`compile \_graph'", "/opt/pnda/logstash-6.2.3/logstash-core/lib/logstash/compiler.rb:12:in `block in compile_sources'", "org/jruby/Ruby Array.java:2486:in`map'", "/opt/pnda/logstash-6.2.3/logstash-core/lib/logstash/compiler.rb:11:in `compile_sources'", "/opt/p nda/logstash-6.2.3/logstash-core/lib/logstash/pipeline.rb:51:in`initialize'", "/opt/pnda/logstash-6.2.3/logstash-core/lib/lo gstash/pipeline.rb:169:in `initialize'", "/opt/pnda/logstash-6.2.3/logstash-core/lib/logstash/pipeline_action/create.rb:40:in`execute'", "/opt/pnda/logsta

```auto
 input {
      tcp {
         port => 20518
         add_field => ["src", "syslog"]
        }
    }

    filter {
        mutate {
            add_field => {
                "host_ip" => "localhost" # change the IP and set something meaningful
            }
            rename => { "message" => "rawdata" } # Put the content of the message to the PNDA Avro 'rawdata' field
            ruby {
                # Convert the Logstash timestamp to a milliseconds timestamp integer
                # You can use whatever makes sense to you as long as the timestamp is a valid timestamp integer in milliseconds
                code => "event.set('timestamp', (event.get('@timestamp').to_f * 1000).to_f * 1000).to_i)"
            }
        }
    }

    output {
            kafka {
                    codec => pnda-avro { schema_uri => "/opt/pnda/pnda.avsc" } # The PNDA Avro schema to use
                    bootstrap_servers => "localhost:9092"
                    topic_id => 'test'
                    compression_type => "none" # "none", "gzip", "snappy", "lz4"
                    value_serializer => 'org.apache.kafka.common.serialization.ByteArraySerializer'
            }
    }

```

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 26, 2018, 1:20pm UTC](https://discuss.elastic.co/t/how-to-install-logstash-ruby-filer-plugin/125600/4 "2018-03-26T13:20:39Z")

</div>

The ruby filter doesn't belong inside the mutate filter.

---

<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:** [April 23, 2018, 1:20pm UTC](https://discuss.elastic.co/t/how-to-install-logstash-ruby-filer-plugin/125600/5 "2018-04-23T13:20:46Z")

</div>

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