# Logstash, split field and remove field

**URL:** <https://discuss.elastic.co/t/logstash-split-field-and-remove-field/225410>\
**Category:** Logstash\
**Created:** [March 27, 2020, 1:02pm UTC](https://discuss.elastic.co/t/logstash-split-field-and-remove-field/225410 "2020-03-27T13:02:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SBH](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@SBH](https://discuss.elastic.co/u/SBH)\
**Post date:** [March 27, 2020, 1:02pm UTC](https://discuss.elastic.co/t/logstash-split-field-and-remove-field/225410/1 "2020-03-27T13:02:28Z")

</div>

Hi,

working on my logstash conf file.

I have a remove field like this:

`remove_field => ["[data][tasks][data]"]`

And then i have a split field like this:

`split {field => "[data][tasks]"}`

But when i see it in Discover, the Data.tasks.Data is there again.

It seems like i'm not removing it on the correct event.

I noticed that if i have the split first, it works, but i want the data to be removed immediatly, so that the data i am working on after, is clean, and the split doesn't have to handle that much data.

Regards

---

<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:** [March 27, 2020, 3:52pm UTC](https://discuss.elastic.co/t/logstash-split-field-and-remove-field/225410/2 "2020-03-27T15:52:12Z")

</div>

> [@SBH](#):
>
> But when i see it in Discover, the Data.tasks.Data is there again.

Field names are case sensitive. data.tasks.data and Data.tasks.Data are different fields.

Also, if [data][tasks] is an array then that remove\_field will not do anything. You need to include the array index in it, or else do something like [this](https://discuss.elastic.co/t/remove-subfield-using-ruby/225055/4).

---

<div class="post-metadata">

**Author:** ![SBH](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@SBH](https://discuss.elastic.co/u/SBH)\
**Post date:** [March 30, 2020, 8:00am UTC](https://discuss.elastic.co/t/logstash-split-field-and-remove-field/225410/3 "2020-03-30T08:00:16Z")

</div>

It is lowercase all the way so no problem. That is not the problem. How do i include array index, that can actually vary?

---

<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:** [March 30, 2020, 3:09pm UTC](https://discuss.elastic.co/t/logstash-split-field-and-remove-field/225410/4 "2020-03-30T15:09:10Z")

</div>

Then use ruby, like the code I linked to.

---

<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:** [April 27, 2020, 3:09pm UTC](https://discuss.elastic.co/t/logstash-split-field-and-remove-field/225410/5 "2020-04-27T15:09:11Z")

</div>

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