# CSV Filter - Backslash double quote parse failure

**URL:** https://discuss.elastic.co/t/csv-filter-backslash-double-quote-parse-failure/315703
**Category:** Logstash
**Created:** [October 3, 2022, 4:22pm UTC](https://discuss.elastic.co/t/csv-filter-backslash-double-quote-parse-failure/315703 "2022-10-03T16:22:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Michele\_De\_Benedet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michele_de_benedet/32/100766_2.png) [@Michele\_De\_Benedet](https://discuss.elastic.co/u/Michele_De_Benedet)
#### Post date: [October 3, 2022, 4:22pm UTC](https://discuss.elastic.co/t/csv-filter-backslash-double-quote-parse-failure/315703/1 "2022-10-03T16:22:07Z")

</div>

Hi,

I am using version 7.12.0  
I'm parsing a csv which looks like this:

```auto
colA;colB;colC
x;"hello \"world\" ";0
y;"hello world";1

```

I cannot parse the x row because I get the following:

```auto
Error parsing csv {:field=>"message", :source=>"x;\"hello \\\"world\\\" \";0", :exception=>#<CSV::MalformedCSVError: Missing or stray quote in line 1>}

```

So I was thinking about removing the `\"` altogether, thus my filter looks like this:

```auto
filter {
  csv {
    autodetect_column_names => "true"
    separator => ";"
    skip_header => "true"
  }
 mutate {
    gsub => ["colB", '\\"', '']
 }
}

```

I have tried many other variants (", \", \\", ...) but I am still getting the same error.

Can someone support?  
Changing the source file/format is not a viable solution.

Thank you

---

<div class="post-metadata">

### Author: ![Michele\_De\_Benedet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michele_de_benedet/32/100766_2.png) [@Michele\_De\_Benedet](https://discuss.elastic.co/u/Michele_De_Benedet)
#### Post date: [October 3, 2022, 4:54pm UTC](https://discuss.elastic.co/t/csv-filter-backslash-double-quote-parse-failure/315703/2 "2022-10-03T16:54:07Z")

</div>

Ok, I figure it out.  
The issue happens BEFORE parsing, so in my case applying a substitution to the whole string works:

```auto
filter {
  mutate {
    gsub => ["message", '\\\"', '']
  }
  csv {
    autodetect_column_names => "true"
    separator => ";"
    skip_header => "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: [October 31, 2022, 4:54pm UTC](https://discuss.elastic.co/t/csv-filter-backslash-double-quote-parse-failure/315703/3 "2022-10-31T16:54:55Z")

</div>

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