Ant*_*ine 13 elasticsearch logstash
我有一个Logstash实例作为服务运行,从Redis读取并输出到Elasticsearch.我刚刚注意到最近几天Elasticsearch没有什么新内容,但Redis列表正在增加.
Logstash日志中填充了重复数千行的2个错误:
:message=>"Got error to send bulk of actions"
:message=>"Failed to flush outgoing items"
Run Code Online (Sandbox Code Playgroud)
原因是:
{"error":"IllegalArgumentException[Malformed action/metadata line [107], expected a simple value for field [_type] but found [START_ARRAY]]","status":500},
Run Code Online (Sandbox Code Playgroud)
此外,尝试停止服务反复失败,我不得不杀死它.重新启动它会清空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"
}
}
Run Code Online (Sandbox Code Playgroud)
小智 1
根据您的日志消息:
{“error”:“IllegalArgumentException[格式错误的操作/元数据行[107],期望字段[_type]有一个简单值,但发现[START_ARRAY]]”,“status”:500},
看来您正在尝试使用type数组而不是字符串的字段来索引文档。
如果没有更多文件,我无法帮助你logstash.conf。但请检查以下内容以确保:
当你使用add_field来改变时,type你实际上变成type了array具有多个值的 ,这就是 Elasticsearch 所抱怨的。
您可以使用mutate join将数组转换为字符串:api 链接
filter {
mutate {
join => { "fieldname" => "," }
}
}
Run Code Online (Sandbox Code Playgroud)| 归档时间: |
|
| 查看次数: |
698 次 |
| 最近记录: |