# CSV conf ig does not parse properly

**URL:** <https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847>\
**Category:** Logstash\
**Created:** [November 16, 2017, 1:49am UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847 "2017-11-16T01:49:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgervais](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pgervais](https://discuss.elastic.co/u/pgervais)\
**Post date:** [November 16, 2017, 1:49am UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/1 "2017-11-16T01:49:56Z")

</div>

I use a simple csv config file as shown below. A  
input {  
file {  
path =\> "/Users/pgervais/Elk/mach.csv”  
start\_position =\> “beginning”  
sincedb\_path =\> “/dev/null”  
}  
}  
filter {  
csv {  
convert =\> {  
"ObsDate" =\> “date”  
"ObsHour" =\> “integer”  
"GPPLoadMIPS" =\> “float”  
"zIIPLoadMIPS" =\> “float”  
"GPPCapacityMIPS" =\> "float”  
"zIIPCapacityMIPS" =\>"float”  
}  
separator =\> “,”  
autodetect\_column\_names =\> true  
}  
}

output {  
elasticsearch {  
hosts =\> "localhost"  
index =\> "mach"  
document\_type =\> "mach\_record"  
}  
stdout {}  
}

According to csv filter docs, i should not get syntax errors on this. When i run it simply as a test using logstash-6.0.0/bin/logstash -f mach.conf -t i get the following error:  
logstash-6.0.0/bin/logstash -f mach.conf -t  
Sending Logstash's logs to /Users/pgervais/Elk/logstash-6.0.0/logs which is now configured via log4j2.properties  
[2017-11-15T20:24:27,154][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"fb\_apache", :directory=\>"/Users/pgervais/Elk/logstash-6.0.0/modules/fb\_apache/configuration"}  
[2017-11-15T20:24:27,161][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"netflow", :directory=\>"/Users/pgervais/Elk/logstash-6.0.0/modules/netflow/configuration"}  
[2017-11-15T20:24:27,276][WARN][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified  
[2017-11-15T20:24:27,454][FATAL][logstash.runner] The given configuration is invalid. Reason: Expected one of #, {, } at line 11, column 4 (byte 171) after input {  
file {  
path =\> "/Users/pgervais/Elk/mach.csv”  
start\_position =\> “beginning”  
sincedb\_path =\> “/dev/null”  
}  
}  
filter {  
csv {  
convert =\> {  
"

I also get errors when i try and specify the columns commnd:  
columns =\> ["Machine","ObsDate" , "ObsHour" , "GPPLoadMIPS", "zIIPLoadMIPS" , "GPPCapacityMIPS","zIIPCapacityMIPS"]

It almost as if the csv is not loaded. So i checked via logstash-plugin logstash-6.0.0/bin/logstash-plugin list  
The csv filter plugin is loaded.

Therefore why is the syntax as described in the logstash csv documentation generating errors?

I get this on version 5.6.4 and 6.00. i have followed the installation instructions.  
What am i missing here?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 16, 2017, 6:36am UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/2 "2017-11-16T06:36:21Z")

</div>

> "ObsDate" =\> “date”

Take a close look. It looks like you're mixing straight quotes with curly ones.

---

<div class="post-metadata">

**Author:** ![pgervais](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pgervais](https://discuss.elastic.co/u/pgervais)\
**Post date:** [November 16, 2017, 1:39pm UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/3 "2017-11-16T13:39:54Z")

</div>

If you look at the documentation they are using " instead of '.  
Will try ' and see what happens.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 16, 2017, 2:14pm UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/4 "2017-11-16T14:14:15Z")

</div>

Yes, double quotes are used throughout the documentation but I wasn't talking about single vs. double quotes but straight vs. curly ones.

---

<div class="post-metadata">

**Author:** ![pgervais](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pgervais](https://discuss.elastic.co/u/pgervais)\
**Post date:** [November 16, 2017, 3:15pm UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/5 "2017-11-16T15:15:32Z")

</div>

Magnus,  
I appreciate your taking the time to reply but frankly i'm missing something here. What do mean you mean by "straight vs. curly one"?

I have changed my config file to use single quotes ' instead of double quotes. "  
Most of the config file parses properly. It fails at the last line .

input {  
file {  
path =\> "/Users/pgervais/Elk/mach.csv”  
start\_position =\> “beginning”  
sincedb\_path =\> “/dev/null”  
}  
}  
filter {  
csv {  
columns =\> ['Obs','Machine Serial#','Obs Date','Obs Hour','GPP Load (MIPS)','zIIP Load (MIPS)','GPP Capacity (MIPS)','zIIP Capacity (MIPS)']

```
    convert => { 
	'Obs Date' => date
    	'Obs Hour' => integer 
    	'GPP Load (MIPS)' => float
    	'zIIP Load (MIPS)' => float
    	'GPP Capacity (MIPS)' => float        
    	'zIIP Capacity (MIPS)' => float 
	}

```

Error shown below: I dont know what its looking for .

logstash-6.0.0/bin/logstash -f mach.conf -t  
Sending Logstash's logs to /Users/pgervais/Elk/logstash-6.0.0/logs which is now configured via log4j2.properties  
[2017-11-16T10:06:06,966][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"fb\_apache", :directory=\>"/Users/pgervais/Elk/logstash-6.0.0/modules/fb\_apache/configuration"}  
[2017-11-16T10:06:06,980][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"netflow", :directory=\>"/Users/pgervais/Elk/logstash-6.0.0/modules/netflow/configuration"}  
[2017-11-16T10:06:07,424][WARN][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified  
[2017-11-16T10:06:08,193][FATAL][logstash.runner] The given configuration is invalid. Reason: Expected one of ", ", any character at line 34, column 1 (byte 687) after input {  
file {  
path =\> "/Users/pgervais/Elk/mach.csv”  
start\_position =\> “beginning”  
sincedb\_path =\> “/dev/null”  
}  
}  
filter {  
csv {  
columns =\> ['Obs','Machine Serial#','Obs Date','Obs Hour','GPP Load (MIPS)','zIIP Load (MIPS)','GPP Capacity (MIPS)','zIIP Capacity (MIPS)']

```
    convert => { 
	'Obs Date' => date
    	'Obs Hour' => integer 
    	'GPP Load (MIPS)' => float
    	'zIIP Load (MIPS)' => float
    	'GPP Capacity (MIPS)' => float        
    	'zIIP Capacity (MIPS)' => float 
	}

```

# separator =\> “,”

```
 }

```

}

output {  
elasticsearch {  
hosts =\> ‘localhost’  
index =\> mach  
document\_type =\> mach\_record  
}  
stdout {}  
}

# separator =\> “,”

```
 }

```

}

output {  
elasticsearch {  
hosts =\> ‘localhost’  
index =\> mach  
document\_type =\> mach\_record  
}  
stdout {}  
}

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 16, 2017, 3:26pm UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/6 "2017-11-16T15:26:12Z")

</div>

> I appreciate your taking the time to reply but frankly i'm missing something here. What do mean you mean by "straight vs. curly one"?

[https://practicaltypography.com/straight-and-curly-quotes.html](https://practicaltypography.com/straight-and-curly-quotes.html)

Make sure all quotes in your configuration files are straight and not curly.

---

<div class="post-metadata">

**Author:** ![pgervais](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pgervais](https://discuss.elastic.co/u/pgervais)\
**Post date:** [November 16, 2017, 3:29pm UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/7 "2017-11-16T15:29:18Z")

</div>

Magnus,  
Can you take a look at the error im getting on my last post? I cant figure out what its expecting.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 16, 2017, 3:43pm UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/8 "2017-11-16T15:43:44Z")

</div>

Nothing obvious, except that it still looks like curly quotes in several places. You should be able to comment out lines to narrow down where the error is. It could be a garbage character, possibly non-printable so it doesn't show up anywhere.

---

<div class="post-metadata">

**Author:** ![pgervais](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pgervais](https://discuss.elastic.co/u/pgervais)\
**Post date:** [November 16, 2017, 3:44pm UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/9 "2017-11-16T15:44:49Z")

</div>

Marcus,  
For all to know: The macbook air keyboard has a smart quote option. Even though i was typing the " key, it must have been doing a substitution. Something to keep in mind. I turned this option off and i can now use " in the config file.  
Thanks for your help.

---

<div class="post-metadata">

**Author:** ![pgervais](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pgervais](https://discuss.elastic.co/u/pgervais)\
**Post date:** [November 16, 2017, 8:10pm UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/10 "2017-11-16T20:10:38Z")

</div>

Marcus,  
Ensured all " are of the proper type. Config file now parses properly.  
Thanks for your help. Issue resolved.

---

<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:** [December 14, 2017, 8:10pm UTC](https://discuss.elastic.co/t/csv-conf-ig-does-not-parse-properly/107847/11 "2017-12-14T20:10:51Z")

</div>

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