Logstash应该是#之一 [英] Logstash expected one of #

查看:119
本文介绍了Logstash应该是#之一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用以下配置文件运行Lostash:

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

给我:

错误:输出{rabbitmq {exchange => test_exchange exchange_type => fanout host => 172.17

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

当我在主机字段中输入类似IP的地址时,logstash似乎有问题.我的配置有什么问题?

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

推荐答案

整个问题出在创建config.conf文件时使用的方法.

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

您正在使用以下命令:

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"}}'

这篇关于Logstash应该是#之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆