# Check if csv parse failed/ Change record type

**URL:** <https://discuss.elastic.co/t/check-if-csv-parse-failed-change-record-type/64066>\
**Category:** Logstash\
**Created:** [October 26, 2016, 9:19pm UTC](https://discuss.elastic.co/t/check-if-csv-parse-failed-change-record-type/64066 "2016-10-26T21:19:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jimmy\_Shephard](https://avatars.discourse-cdn.com/v4/letter/j/cab0a1/32.png) [@Jimmy\_Shephard](https://discuss.elastic.co/u/Jimmy_Shephard)\
**Post date:** [October 26, 2016, 9:19pm UTC](https://discuss.elastic.co/t/check-if-csv-parse-failed-change-record-type/64066/1 "2016-10-26T21:19:18Z")

</div>

Hi,

I need logic in my file input filter such that if a csv parse fails I can catch that and change the record type. This is the structure I have

filter{

csv {  
add\_tag = \> 'OK'  
}

//How would I check if tag above is present here? And is it possible to change the record type?  
}

Thanks

---

<div class="post-metadata">

**Author:** ![eperry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eperry/32/551_2.png) [@eperry](https://discuss.elastic.co/u/eperry)\
**Post date:** [October 26, 2016, 11:23pm UTC](https://discuss.elastic.co/t/check-if-csv-parse-failed-change-record-type/64066/2 "2016-10-26T23:23:38Z")

</div>

read up on conditionals  
[https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#conditionals](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#conditionals)

if [type] =~ /mytype/ {  
# do something  
}

---

<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:** [July 6, 2017, 4:32am UTC](https://discuss.elastic.co/t/check-if-csv-parse-failed-change-record-type/64066/3 "2017-07-06T04:32:29Z")

</div>


