# Ruby code to iterate through message

**URL:** <https://discuss.elastic.co/t/ruby-code-to-iterate-through-message/162567>\
**Category:** Elasticsearch\
**Created:** [January 1, 2019, 1:05pm UTC](https://discuss.elastic.co/t/ruby-code-to-iterate-through-message/162567 "2019-01-01T13:05:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alashqar77](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@alashqar77](https://discuss.elastic.co/u/alashqar77)\
**Post date:** [January 1, 2019, 1:05pm UTC](https://discuss.elastic.co/t/ruby-code-to-iterate-through-message/162567/1 "2019-01-01T13:05:29Z")

</div>

Hi

I have input message as follow without header columns:  
2006-02-15,76.5,77.5,76,80,58353 2006-02-16,77,80.1,77,76.3,49795 2006-02-19,82.3,82.3,76,79,45729 2006-02-20,79.5,79.5,75.5,79.4,63007

what i want to do is split the message by space then loop through and then split each token again separated by comma to create new events, also how do i create the field names while looping?  
as far as i know i cant use loop in logstash and i need ruby,,,which i never used before.  
any help will be really appreciated...  
thanx

---

<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:** [January 29, 2019, 1:05pm UTC](https://discuss.elastic.co/t/ruby-code-to-iterate-through-message/162567/2 "2019-01-29T13:05:32Z")

</div>

Closed on January 29, 2019, 1:05pm UTC

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