Search code examples
logstashelastic-stacklogstash-json

logstash index not assigned with json pattern


I am new to ELK stack and trying to configure fields in kibana dashboard. my logstash.conf

input {
tcp {
    port => 5000
}
}

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

}}

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

But index test is not present when i use curl to elastic server. Iam using python-logstash.I have installed json plugin. someone can help me how to send the json to elastic search so that I could view it on kibana dashboard?


Solution

  • Found the issue. There are two libraries json and jsonencode. If you are sending dictionary in text format(or using python logstash) make sure you use json encode