# Where can i learning the official grammar of ruby code which apply in logstash script

**URL:** <https://discuss.elastic.co/t/where-can-i-learning-the-official-grammar-of-ruby-code-which-apply-in-logstash-script/203368>\
**Category:** Logstash\
**Created:** [October 14, 2019, 2:25am UTC](https://discuss.elastic.co/t/where-can-i-learning-the-official-grammar-of-ruby-code-which-apply-in-logstash-script/203368 "2019-10-14T02:25:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![terrymu](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@terrymu](https://discuss.elastic.co/u/terrymu)\
**Post date:** [October 14, 2019, 2:25am UTC](https://discuss.elastic.co/t/where-can-i-learning-the-official-grammar-of-ruby-code-which-apply-in-logstash-script/203368/1 "2019-10-14T02:25:52Z")

</div>

Hi experts,

Would you please provide some materials or WEB Link for me that include the introduction of grammar of ruby code which apply in logstash script.

```
Such like this:

ruby {
    code => 'event.get("message").scan(/loc[A-Z]{4}/).each {|loc| event.tag(loc)}'
}

ruby {
 event.set('except_fcn_trace', event.get('except_fcn_trace').delete(' ').scan(/.{16}/).join(' '))
}

```

I just want to know how many event function(.get .set .scan . delete) defined and how to use them in logstash.

Thank you.

---

<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:** [October 14, 2019, 12:10pm UTC](https://discuss.elastic.co/t/where-can-i-learning-the-official-grammar-of-ruby-code-which-apply-in-logstash-script/203368/2 "2019-10-14T12:10:42Z")

</div>

.get and .set are part of the logstash [event API](https://www.elastic.co/guide/en/logstash/current/event-api.html). .scan and .delete are functions of a [Ruby string](https://ruby-doc.org/core-2.5.3/String.html).

---

<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:** [November 11, 2019, 12:11pm UTC](https://discuss.elastic.co/t/where-can-i-learning-the-official-grammar-of-ruby-code-which-apply-in-logstash-script/203368/3 "2019-11-11T12:11:05Z")

</div>

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