# Logstash CSV filter plugins

**URL:** <https://discuss.elastic.co/t/logstash-csv-filter-plugins/313327>\
**Category:** Logstash\
**Created:** [August 31, 2022, 7:55am UTC](https://discuss.elastic.co/t/logstash-csv-filter-plugins/313327 "2022-08-31T07:55:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![priyankamondalhcl](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@priyankamondalhcl](https://discuss.elastic.co/u/priyankamondalhcl)\
**Post date:** [August 31, 2022, 7:55am UTC](https://discuss.elastic.co/t/logstash-csv-filter-plugins/313327/1 "2022-08-31T07:55:29Z")

</div>

Hi Team,

I am trying to read csv file and storing it in elasticsearch.  
Is there any way to read column from file itself (header of csv file ) in logstash "csv filter plugins". currently I am manually setting up the column name.

logstash config I am using:

filter {  
csv {  
source =\> "message"  
separator =\> ","  
skip\_header =\> "true"  
columns =\> ["identity/LineItemId", "identity/TimeInterval", "bill/InvoiceId", "bill/InvoicingEntity", "bill/BillingEntity", "bill/BillType", "bill/PayerAccountId"] }  
mutate {remove\_field =\> ["event", "message"]}  
}

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [August 31, 2022, 8:19am UTC](https://discuss.elastic.co/t/logstash-csv-filter-plugins/313327/2 "2022-08-31T08:19:18Z")

</div>

> [@priyankamondalhcl](#):
>
> manually setting up the column name.

Add to

```auto
csv{...
        autodetect_column_names => true
        autogenerate_column_names => true
...
}

```

---

<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 28, 2022, 8:19am UTC](https://discuss.elastic.co/t/logstash-csv-filter-plugins/313327/3 "2022-09-28T08:19:41Z")

</div>

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