# Logstash 7.3. ruby undefined method split

**URL:** <https://discuss.elastic.co/t/logstash-7-3-ruby-undefined-method-split/196778>\
**Category:** Logstash\
**Created:** [August 26, 2019, 1:31pm UTC](https://discuss.elastic.co/t/logstash-7-3-ruby-undefined-method-split/196778 "2019-08-26T13:31:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmyvalmer19](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jimmyvalmer19](https://discuss.elastic.co/u/jimmyvalmer19)\
**Post date:** [August 26, 2019, 1:31pm UTC](https://discuss.elastic.co/t/logstash-7-3-ruby-undefined-method-split/196778/1 "2019-08-26T13:31:20Z")

</div>

Hi,  
I don't know how to use the filebeat fields listed here:  
[https://www.elastic.co/guide/en/beats/filebeat/current/exported-fields-log.html](https://www.elastic.co/guide/en/beats/filebeat/current/exported-fields-log.html)  
In logstash.

I need to extract the application name from "log.file.path" field

This is how I see "log.file.path" in Kibana

/home/elk/sample\_logs/bdp/hive/hadoop-cmf-hive-HIVESERVER2-cv38x072-internal.sos.kb.cz.log.out

where "hive" is the application name i wan't work with.

This has worked in Logstash 6.8:  
ruby {  
code =\> "event.set('app\_name',event.get('source').split('/')[-2])"  
}

Now with logstash 7.3. it gives an ERROR:  
/elastic/log/logstash/logstash-plain.log:[2019-08-26T13:08:52,098][ERROR][logstash.filters.ruby] Ruby exception occurred: undefined method `split' for nil:NilClas

---

<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:** [August 26, 2019, 1:39pm UTC](https://discuss.elastic.co/t/logstash-7-3-ruby-undefined-method-split/196778/2 "2019-08-26T13:39:40Z")

</div>

You are trying to split [source] but you are saying the path is in [log][file][path].

---

<div class="post-metadata">

**Author:** ![jimmyvalmer19](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jimmyvalmer19](https://discuss.elastic.co/u/jimmyvalmer19)\
**Post date:** [August 26, 2019, 1:46pm UTC](https://discuss.elastic.co/t/logstash-7-3-ruby-undefined-method-split/196778/3 "2019-08-26T13:46:26Z")

</div>

I'm seing log.file.path field in Kibana and it contains the data I need.

Before upgrading To Logstash 7.3. i used this  
ruby {  
code =\> "event.set('app\_name',event.get('source').split('/')[-2])"  
}

But now it's not working, so I need to figure out, how to get the data now.

---

<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:** [August 26, 2019, 1:53pm UTC](https://discuss.elastic.co/t/logstash-7-3-ruby-undefined-method-split/196778/4 "2019-08-26T13:53:50Z")

</div>

> [@jimmyvalmer19](#):
>
> I'm seing log.file.path field in Kibana

kibana and logstash have different ways of representing fields inside objects. If the log object contains a field called file then kibana will call it log.file, but in logstash that is referenced using [log][file].

---

<div class="post-metadata">

**Author:** ![jimmyvalmer19](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jimmyvalmer19](https://discuss.elastic.co/u/jimmyvalmer19)\
**Post date:** [August 26, 2019, 2:00pm UTC](https://discuss.elastic.co/t/logstash-7-3-ruby-undefined-method-split/196778/5 "2019-08-26T14:00:08Z")

</div>

> [@Badger](#):
>
> [log][file][path]

thank's a lot for help! 🙂

---

<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:** [September 23, 2019, 2:00pm UTC](https://discuss.elastic.co/t/logstash-7-3-ruby-undefined-method-split/196778/6 "2019-09-23T14:00:10Z")

</div>

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