我正在尝试为以下输入配置logstash - nginx访问,nginx错误&日志遵循自定义模式&下面是logstash.conf
ERROR logstash.agent - Cannot load an invalid configuration {:reason=>"Expected one of #, {
at line 84, column 9 (byte 1883) after output {\n \nstdout { codec => rubydebug }\nif [type] ==
\"nginx-access\" {\n elasticsearch { hosts => localhost }\n index "}
但是在运行它时,我收到以下错误
getData(data[0])
.then((val) => console.log(...))
.then(() => getData(data[1])
.then(...
我不确定错误是什么。有人可以帮我搞清楚吗?
我也试过运行hexdump&没有垃圾字符似乎很好
答案 0 :(得分:1)
我想你忘记了""放置本地主机
elasticsearch {
hosts => ["localhost"]
index => "%{tempIndex}-%{+xxxx.ww}"
document_type => "%{[@metadata][type]}"
}
答案 1 :(得分:0)
正确答案是指数'如下面的弹性搜索块
output {
stdout { codec => rubydebug }
if [type] == "nginx-access" {
elasticsearch { hosts => localhost
index => "nginx-access-%{+YYYY.MM.dd}"
}
} else if [type] == "nginx-error" {
elasticsearch {
hosts => localhost
index => "nginx-error-%{+YYYY.MM.dd}"
}
} else {
elasticsearch {
hosts => localhost
}
}
}