我有一个Logstash实例作为服务运行,从Redis读取并输出到Elasticsearch。我刚刚注意到过去几天在Elasticsearch中没有什么新东西,但Redis列表正在增加。Logstash代理不索引
Logstash日志充满了2个错误重复千行:
:message=>"Got error to send bulk of actions"
:message=>"Failed to flush outgoing items"
其原因是:
{"error":"IllegalArgumentException[Malformed action/metadata line [107], expected a simple value for field [_type] but found [START_ARRAY]]","status":500},
此外,试图阻止该服务屡屡失败,我不得不杀了它。重新启动后,清空Redis列表并将所有内容导入Elasticsearch。它现在似乎工作正常。
但我不知道如何防止再次发生。提到的type
字段被设置为每个输入指令的字符串,所以我不明白它是如何成为一个数组。
我错过了什么?
我使用Elasticsearch 1.7.1和Logstash 1.5.3。该logstash.conf
文件看起来像这样:
input {
redis {
host => "127.0.0.1"
port => 6381
data_type => "list"
key => "b2c-web"
type => "b2c-web"
codec => "json"
}
redis {
host => "127.0.0.1"
port => 6381
data_type => "list"
key => "b2c-web-staging"
type => "b2c-web-staging"
codec => "json"
}
/* other redis inputs, only key/type variations */
}
filter {
grok {
match => ["msg", "Cache hit %{WORD:query} in %{NUMBER:hit_total:int}ms. Network: %{NUMBER:hit_network:int} ms. Deserialization %{NUMBER:hit_deserial:int}"]
add_tag => ["cache_hit"]
tag_on_failure => []
}
/* other groks, not related to type field */
}
output {
elasticsearch {
host => "[IP]"
port => "9200"
protocol=> "http"
cluster => "logstash-prod-2"
}
}
你能提供你的配置,或者至少节选你设置类型字段?这似乎与elasticsearch bulk api有关:https://github.com/elastic/elasticsearch/issues/11458 – hurb
事实上,这个问题看起来很相似,但是数组问题而不是null。 – Antoine
您可以清除logstash.log文件,更新您的elasticsearch-logstash连接插件并重新启动它。我有一个类似的问题,在我的情况下,我的elasticsearch首先在B/W下,重新启动后,我有一些插件问题和连接问题。 –