Logstash expected one of #

Heschoon picture Heschoon · Apr 27, 2015 · Viewed 19.8k times · Source

I'm currently trying to run Lostash with the following config file:

input { 
    stdin { } 
} 
output { 
    rabbitmq { 
        exchange => "test_exchange" 
        exchange_type => "fanout" 
        host => "172.17.x.x" 
    } 
}

I do however get an error:

logstash agent --configtest -f -config.conf

gives me:

Error: Expected one of #, } at line 1, column 105 (byte 105) after output { rabbitmq { exchange => test_exchange exchange_type => fanout host => 172.17

It seems that logstash has the problem when I put an IP-like address in the host field. What is wrong with my config?

Answer

Heschoon picture Heschoon · Apr 27, 2015

The whole problem was in the method you used when created the config.conf file.

You were using the following command:

echo "input {stdin{}} output{rabbitmq{exchange=>"test_exchange" exchange_type =>"fanout" host=>"172.17.x.x"}}"

Surrounding a string containing double quotes with double quotes isn't a good idea...

By using single quotes around the string, the problem is solved...

echo 'input {stdin{}} output{rabbitmq{exchange=>"test_exchange" exchange_type =>"fanout" host=>"172.17.x.x"}}'