未分配 json 模式的 logstash 索引

logstash index not assigned with json pattern

我是 ELK 堆栈的新手,正在尝试在 kibana 仪表板中配置字段。我的 logstash.conf

input {
tcp {
    port => 5000
}
}

filter{
json{
    source => "message"
    add_field => {
        "newfiled" => "static"
    }
}

}}

output {
elasticsearch {
    hosts => "elasticsearch:9200"
    index => "test"
}
}

但是当我对弹性服务器使用 curl 时,索引测试不存在。我正在使用 python-logstash.I 已经安装了 json 插件。有人可以帮助我如何将 json 发送到弹性搜索,以便我可以在 kibana 仪表板上查看它?

发现问题。有两个库 json 和 jsonencode。如果您以文本格式发送字典(或使用 python logstash),请确保您使用 json encode