# CSV Filter - Quote character parse failure

**URL:** https://discuss.elastic.co/t/csv-filter-quote-character-parse-failure/116611
**Category:** Logstash
**Created:** [January 23, 2018, 8:01am UTC](https://discuss.elastic.co/t/csv-filter-quote-character-parse-failure/116611 "2018-01-23T08:01:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)
#### Post date: [January 23, 2018, 8:01am UTC](https://discuss.elastic.co/t/csv-filter-quote-character-parse-failure/116611/1 "2018-01-23T08:01:25Z")

</div>

I have a CSV file and the format is something like this:

`"102","60","Open","I hope this works out for \"random.guy@gmail.com\""`

When i parse this using the CSV filter i get the following error:

`[2018-01-23T13:11:58,523][WARN][logstash.filters.csv] Error parsing csv {:field=>"message", :source=>"\"102\",\"60\",\"Open\",\"I hope this works out for \\\"random.guy@gmail.com\\\"\"", :exception=>#<CSV::MalformedCSVError: Missing or stray quote in line 1>}`

Why is this an issue? The input seems to be perfectly quoted. Any insight would be appreciated!

Regards,  
N

---

<div class="post-metadata">

### Author: ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)
#### Post date: [January 23, 2018, 11:25am UTC](https://discuss.elastic.co/t/csv-filter-quote-character-parse-failure/116611/2 "2018-01-23T11:25:05Z")

</div>

For anyone suffering with this issue, it seems to be an issue with Ruby. I cannot confirm this, but i believe that since logstash is written in Ruby, this could be the cause of it.

Here is a reference question that was asked on stackoverflow which gives the exact same error as logstash:

> <https://stackoverflow.com/questions/14534522/ruby-csv-parsing-string-with-escaped-quotes>

> <https://stackoverflow.com/questions/29289208/missing-or-stray-quote-in-line-1-csvmalformedcsverror>

I will open an issue on the plugin page just to confirm if this is indeed a bug. **The current solution that I have for the issue is to use gsub to replace the `\"` characters with `'` or `null`.**

Regards,  
N

---

<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: [February 20, 2018, 11:26am UTC](https://discuss.elastic.co/t/csv-filter-quote-character-parse-failure/116611/3 "2018-02-20T11:26:10Z")

</div>

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