# Get only specific fields from a data file

**URL:** <https://discuss.elastic.co/t/get-only-specific-fields-from-a-data-file/195466>\
**Category:** Logstash\
**Created:** [August 16, 2019, 9:53am UTC](https://discuss.elastic.co/t/get-only-specific-fields-from-a-data-file/195466 "2019-08-16T09:53:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ROok](https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/32.png) [@ROok](https://discuss.elastic.co/u/ROok)\
**Post date:** [August 16, 2019, 9:53am UTC](https://discuss.elastic.co/t/get-only-specific-fields-from-a-data-file/195466/1 "2019-08-16T09:53:09Z")

</div>

Hi all

I'm new in elasticsearch and I don't have much knowledge about it.  
I have a data file that contains about a hundred fields but I only need 25 fields.  
However, I'm not sure which logstash filter to use to exctrat fields that I want. I really need help.  
I use logstash 7 and data must be sent to Elasticsearch 7.

Any Ideas ?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [August 16, 2019, 8:27pm UTC](https://discuss.elastic.co/t/get-only-specific-fields-from-a-data-file/195466/2 "2019-08-16T20:27:37Z")

</div>

What format is the datafile in?  
CSV? JSON? XML?

Once you know which input filter to apply then you can always remove the data fields that you don't want using the mutate filter inside logstash.

[https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-remove\_field](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-remove_field)

---

<div class="post-metadata">

**Author:** ![ROok](https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/32.png) [@ROok](https://discuss.elastic.co/u/ROok)\
**Post date:** [August 19, 2019, 1:48pm UTC](https://discuss.elastic.co/t/get-only-specific-fields-from-a-data-file/195466/3 "2019-08-19T13:48:55Z")

</div>

Hello Andreas,  
Thanks for your reply...

The datafile format is not CSV, JSON or XML. The structure is quite particular and it's formed like this : Value1 Value2Value3Value4 Value5 Value6 ....  
I try to use the CSV filter and mutate but it does not put the right values in the appropriate fields

---

<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 16, 2019, 1:49pm UTC](https://discuss.elastic.co/t/get-only-specific-fields-from-a-data-file/195466/4 "2019-09-16T13:49:08Z")

</div>

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