# How to extract data from multiline(codec)

**URL:** <https://discuss.elastic.co/t/how-to-extract-data-from-multiline-codec/287575>\
**Category:** Logstash\
**Created:** [October 25, 2021, 12:22pm UTC](https://discuss.elastic.co/t/how-to-extract-data-from-multiline-codec/287575 "2021-10-25T12:22:15Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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 25, 2021, 7:26pm UTC](https://discuss.elastic.co/t/how-to-extract-data-from-multiline-codec/287575/3 "2021-10-25T19:26:39Z")

</div>

If measData is an object, then see [here](https://discuss.elastic.co/t/how-to-dynamically-move-nested-key-value-to-root-level/180006/2). If you want to remove a prefix from the key name you could try

```
ruby {
    code => '
        event.to_hash.each { |k, v|
            if k =~ /^measData\./
                newK = k.sub(/^measData\./, "")
                event.set(newK, event.remove(k))
            end
        }
    '
}
```

---

_[View the full topic](https://discuss.elastic.co/t/how-to-extract-data-from-multiline-codec/287575)._
