Check if csv parse failed/ Change record type

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

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

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