# Logstash Drop header line while csv upload

**URL:** <https://discuss.elastic.co/t/logstash-drop-header-line-while-csv-upload/118352>\
**Category:** Logstash\
**Created:** [February 4, 2018, 5:25pm UTC](https://discuss.elastic.co/t/logstash-drop-header-line-while-csv-upload/118352 "2018-02-04T17:25:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![scch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/scch/32/25504_2.png) [@scch](https://discuss.elastic.co/u/scch)\
**Post date:** [February 4, 2018, 5:25pm UTC](https://discuss.elastic.co/t/logstash-drop-header-line-while-csv-upload/118352/1 "2018-02-04T17:25:28Z")

</div>

Hi, How to drop first header line of csv file ?

i am trying below code.. and want to drop complete document. Please advise..

filter {  
if [message] =~ /^Occurred On/ {  
drop {}  
}  
}

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 4, 2018, 10:11pm UTC](https://discuss.elastic.co/t/logstash-drop-header-line-while-csv-upload/118352/2 "2018-02-04T22:11:46Z")

</div>

That looks fine, depending on what the input looks like.

---

<div class="post-metadata">

**Author:** ![scch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/scch/32/25504_2.png) [@scch](https://discuss.elastic.co/u/scch)\
**Post date:** [February 5, 2018, 5:31am UTC](https://discuss.elastic.co/t/logstash-drop-header-line-while-csv-upload/118352/3 "2018-02-05T05:31:13Z")

</div>

The CSV input contain 138 fields and one field is Occurred On...

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 5, 2018, 6:55am UTC](https://discuss.elastic.co/t/logstash-drop-header-line-while-csv-upload/118352/4 "2018-02-05T06:55:53Z")

</div>

And that's the first field? Then it should work just fine. Try creating a minimal example that exhibits the problem.

---

<div class="post-metadata">

**Author:** ![scch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/scch/32/25504_2.png) [@scch](https://discuss.elastic.co/u/scch)\
**Post date:** [February 5, 2018, 8:48am UTC](https://discuss.elastic.co/t/logstash-drop-header-line-while-csv-upload/118352/5 "2018-02-05T08:48:23Z")

</div>

yup you are right it is not first field...it is working fine now 🙂

filter {  
if [message] =~ /^Type/ {  
drop {}  
}  
}

---

<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:** [March 5, 2018, 8:48am UTC](https://discuss.elastic.co/t/logstash-drop-header-line-while-csv-upload/118352/6 "2018-03-05T08:48:45Z")

</div>

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