# How to send grok field into ruby

**URL:** <https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381>\
**Category:** Logstash\
**Created:** [May 26, 2018, 8:29am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381 "2018-05-26T08:29:22Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![veerendranath\_lukkan](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@veerendranath\_lukkan](https://discuss.elastic.co/u/veerendranath_lukkan)\
**Post date:** [May 26, 2018, 8:29am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/1 "2018-05-26T08:29:22Z")

</div>

filter{  
grok{  
match =\>{"message" =\> "%{GREEDYDATA:selectedMessage}"}  
}  
Ruby{  
path ="test.rb"  
script\_params =\> {

```
   "percentage" => selectedMessage }

```

}  
}

how can send any example!

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 27, 2018, 6:39am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/2 "2018-05-27T06:39:29Z")

</div>

What does your data look like? What are you trying to achieve? Showing an example is often much better than trying to describe the problem?

---

<div class="post-metadata">

**Author:** ![veerendranath\_lukkan](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@veerendranath\_lukkan](https://discuss.elastic.co/u/veerendranath_lukkan)\
**Post date:** [May 28, 2018, 7:04am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/3 "2018-05-28T07:04:19Z")

</div>

how can i access grok filter "%{GREADYDATA:selectedMessage}" in Ruby filter script\_params ?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 28, 2018, 7:14am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/4 "2018-05-28T07:14:43Z")

</div>

> [@veerendranath\_lukkan](#):
>
> match =\>{"message" =\> "%{GREEDYDATA:selectedMessage}"}

This doesn't really make much sense as it will just copy the message field into a `selectedMessage` field. Please explain what you are trying to do with your data, not how.

Why do you need to use a ruby filter? What do you want to do with it?

---

<div class="post-metadata">

**Author:** ![veerendranath\_lukkan](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@veerendranath\_lukkan](https://discuss.elastic.co/u/veerendranath_lukkan)\
**Post date:** [May 28, 2018, 7:29am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/5 "2018-05-28T07:29:37Z")

</div>

hi christian\_Dahlqvist,  
my log data is different patterns  
grok {  
match =\> { "message" =\> "%{TIMESTAMP\_ISO8601:Date} %{TIMESTAMP\_ISO8601:Actual\_Date} (?[\w.|-]+) \<%{LOGLEVEL:Severity}\> (?[\w:|\_]+): %{GREEDYDATA:Detalis}"}

}  
Above filter i used after "%{GREEDYDATA:Detalis}" this data is i need to send ruby filter and run regux operation.  
i used ruby path and script\_params to perform .  
how can i do this ?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 28, 2018, 8:25am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/6 "2018-05-28T08:25:00Z")

</div>

You should be able to get to all fields of the event through the `event` that is passed to the filter method. I would expect the filter to be initialised based on the script\_params once and not per event.

---

<div class="post-metadata">

**Author:** ![veerendranath\_lukkan](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@veerendranath\_lukkan](https://discuss.elastic.co/u/veerendranath_lukkan)\
**Post date:** [May 28, 2018, 9:32am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/7 "2018-05-28T09:32:10Z")

</div>

Error:-  
Could not process event: Direct event field references (i.e. event['field']) have been disabled in favor of using event get and set methods (e.g. event.get('field')). Please consult the Logstash 5.0 breaking changes documentation for more details.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 28, 2018, 10:47am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/8 "2018-05-28T10:47:36Z")

</div>

That error message explains it quite well.

---

<div class="post-metadata">

**Author:** ![veerendranath\_lukkan](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@veerendranath\_lukkan](https://discuss.elastic.co/u/veerendranath_lukkan)\
**Post date:** [May 28, 2018, 11:54am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/9 "2018-05-28T11:54:50Z")

</div>

Thanks i got it

---

<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:** [June 25, 2018, 11:54am UTC](https://discuss.elastic.co/t/how-to-send-grok-field-into-ruby/133381/10 "2018-06-25T11:54:58Z")

</div>

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