i looking for many many time and also consult in here to found one solution to resolve problem json in elastic using logstash. my config here
input {
tcp {
port => 9000
}
}
filter{
json{
source => "message"
target => "doc"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => logstash-%{+YYYY.MM.dd}
}
}
but my elastic still have string message document not json. Document like that
{
"_index": "logstash-2017.05.12",
"_type": "logs",
"_id": "AVv8C4O4qok70-ifTOnm",
"_score": null,
"_source": {
"message": "{\"name\":\"abc\",\"id\":1494582167248}",
"@version": "1",
"@timestamp": "2017-05-12T09:42:47.263Z",
"host": "172.0.0.1",
"port": 53763
},
"fields": {
"@timestamp": [
1494582167263
]
},
"sort": [
1494582167263
]
}
Any one can help me how to fix inorder to name and id filed is as an member propeter of _source . Im expect document log like
"_source": {
"name":"abc",
"id": 1494582167248
"@version": "1",
"@timestamp": "2017-05-12T09:42:47.263Z",
"host": "192.168.2.251",
"port": 53763
}