Error: Expected one of #, ", ', }

Hi all, I am facing a problem with logstash.

Here's the config file -

input {
file { path => "/home/app/estest.csv" start_position => "beginning" } }
filter {
}
output {
elasticsearch { hosts => "http://myownhost:9200" index => "revenue" document_type => "customer" } }

It's giving the error below -

Error: Expected one of #, ", ', } at line 6, column 18 (byte 132) after output {
elasticsearch {

hexdump -C also didn't give any clue.

I am not able to pin point any error here. Please help. Thanks

Hi,
try this configuration

input
{
file
{
path => "/home/app/estest.csv"
start_position => "beginning"
}
}
filter
{
}
output
{
elasticsearch
{
hosts => ["myownhost:9200"]
index => "revenue"
document_type => "customer"
}
}

notice hosts value between '[' and ']'

Got this error

Error: Expected one of #, ", ', } at line 6, column 18 (byte 170) after output {
elasticsearch {

Did you check your indentation? Logstash config files require accurate indentation. Make sure to have the appropriate amount of spaces before each line.

Yeah, got it working. Firstly my logstash version was quite lower so it didn't support hosts. And removed some spaces. Here's the working one.

input
{
file { path => "/home/app/estest.csv" start_position => "beginning" sincedb_path => "/home/app/input.log" } }
filter
{
}
output
{
elasticsearch { index => "revenue" hosts => ["http://myownhost:9200"] } }

1 Like

Logstash config files require accurate indentation.

The pipeline configuration files we're talking about here don't care about the indentation.

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