Hi All,
I have to parse json logs using Logstash. I have a file with my JSON data. I am using the following config and it works perfectly fine for most cases.
input {
file {
path => "/opt/logs/*.log"
sincedb_path => "/dev/null"
start_position => "beginning"
codec => json
}
}
output {
elasticsearch {...}
}
The problems start to occur when one of the logs have an array of json data and it is parsed and visible in Kibana as follows:
{
"port": "53",
"address": "radeing.com",
"protocol": "udp",
"sname": "Trojan.Pony",
},
{
"port": "80",
"address": "radeing.com",
"sid": "89041083",
"type": "VmsigMatch",
"sname": "Downloader.Win.Generic",
"protocol": "tcp"
}
I also get the object not well supported error in Kibana.
The raw message that gives this info is as follows:
"cnc-services": {
"cnc-service": [
{
"address": "radeing.com",
"port": "53",
"sname": "Trojan.Pony",
"protocol": "udp"
},
{
"type": "VmsigMatch",
"address": "radeing.com",
"url": "hxxp:///server/shit.exe",
"protocol": "tcp",
"port": "80",
"sname": "Downloader.Win.Generic",
}
]
}
The intended output is something as follows:
cnc-services.cnc-service.address: ["radeing.com", "google.com"]
cnc-services.cnc-service.port: ["53", "80"]
Could someone please help?