# exception=\>#\<CSV::MalformedCSVError: Unclosed quoted field on line 1

**URL:** https://discuss.elastic.co/t/exception-csv-malformedcsverror-unclosed-quoted-field-on-line-1/90703
**Category:** Logstash
**Created:** [June 24, 2017, 8:50am UTC](https://discuss.elastic.co/t/exception-csv-malformedcsverror-unclosed-quoted-field-on-line-1/90703 "2017-06-24T08:50:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)
#### Post date: [June 24, 2017, 8:50am UTC](https://discuss.elastic.co/t/exception-csv-malformedcsverror-unclosed-quoted-field-on-line-1/90703/1 "2017-06-24T08:50:22Z")

</div>

Hi Experts,

I am getting `exception=>#<CSV::MalformedCSVError: Unclosed quoted field on line 1` error while parsing a CSV file. Here is my data looks like . I am getting comma separated values surrounded by double quotes

May 30 22:59:55 10.0.0.0 "4","0","","","Authentication/Verify","Operating System"

in logstash5.4 I am defining column names and replacing double quotes with single quote because values were getting ignored if they are blank . I thought I parsed the whole csv like 80% but now i checked the logs and I am getting above error , not sure where it is failing .

my LS configuration

> ```
> filter {
> grok { match=>["message",'%{CEFDate:sysdate}\s%{cefip:sysip}\s%{CEFMSG:endmessage}'] }
> mutate {
> gsub => ["message","\"","'"]
> }
> csv {
> source => "endmessage"
> autogenerate_column_names => false
> columns =>["baseCount","AC","bytesIn","bytesOut","behavior","dvcgroup"]
> }}
> 
> ```

Not sure if this problem is because of empty value (byteIn, byteOut) or a white space in dvcgroup (Operating System). I do not found any solution , can someone help me to understand what could be the problem .

---

<div class="post-metadata">

### Author: ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)
#### Post date: [June 24, 2017, 6:53pm UTC](https://discuss.elastic.co/t/exception-csv-malformedcsverror-unclosed-quoted-field-on-line-1/90703/2 "2017-06-24T18:53:33Z")

</div>

Never Mind ,

So I got the problem it was with my data . So I had mentioned that I was able to parse more than 80% of data with above config . Rest 20 % was not in proper csv format which causes the problem . I exclude those and things works . So no more errors.

---

<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 22, 2017, 6:53pm UTC](https://discuss.elastic.co/t/exception-csv-malformedcsverror-unclosed-quoted-field-on-line-1/90703/3 "2017-07-22T18:53:47Z")

</div>

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