Hi.
I'm trying to split into several events a JSON input.
I have something like this:
{
"Domains": [
{
"name": "location",
"hash_size": 4096,
"AORs": [
{
"AOR": "d1.580@my.domain.net",
"Contacts": [
{
"Contact": "sip:d1.580@16.9.246.120:4359;rinstance=d1.580-15b6daaca13bc79c4ff8da4c2ca8769d;transport=TLS",
"ContactID": "3173841468645438742",
"Expires": 105,
"Q": "",
"Callid": "ps0Y2-jLhWLY5oJMJqwZrw..@216.93.246.122",
"Cseq": 1163,
"User-agent": " Server 3.0.1 (22505)",
"State": "CS_SYNC",
"Flags": 0,
"Cflags": "",
"Socket": "tls:10.10.10.133:5061",
"Methods": 3567,
"SIP_instance": "<urn:uuid:e46b50f0-6e49-488a-b205-55f70df70718>"
}
]
},
{
"AOR": "d1.558@my.domain.net",
"Contacts": [
{
"Contact": "sip:d1.558@192.168.6.4:5784;rinstance=f3b8df9d4d9b8285;transport=tls",
"ContactID": "4044167362323240131",
"Expires": 535,
"Q": "",
"Callid": "104875ZDI0NzE4MjdlOWRiZDNlYzY3NDhmMzM0MmVmODg4Zjc",
"Cseq": 43,
"User-agent": "SF 6.2.2.0 stamp 104875",
"Received": "sip:192.168.6.4:5784;transport=tls",
"State": "CS_SYNC",
"Flags": 0,
"Cflags": "SIP_PING NAT",
"Socket": "tls:10.10.10.133:5061",
"Methods": 5951
}
]
},
{
"AOR": "d2.521@my.domain.net",
"Contacts": [
{
"Contact": "sip:d2.521@192.168.6.4:17422;rinstance=008dc2fffa48bde7;transport=tls",
"ContactID": "2339408900186963433",
"Expires": 351,
"Q": "",
"Callid": "104875NjQ4YzU5ZjA4YzQ1MTg1NzQ3OTgzMDEyMTQ1NTkxODg",
"Cseq": 582,
"User-agent": "SF 6.2.2.0 stamp 104875",
"Received": "sip:192.168.6.4:38431;transport=tls",
"State": "CS_SYNC",
"Flags": 0,
"Cflags": "SIP_PING NAT",
"Socket": "tls:10.10.10.133:5061",
"Methods": 5951
}
]
}
]
}
]
}
What i need to do create an event per element in the AORs
list, so in the example in need to convert that JSON array into three events like this:
{
"index": index1
"timestamp": XXXXXX
"AOR": "d2.521@my.domain.net",
"Contacts": [
{
"Contact": "sip:d2.521@192.168.6.4:17422;rinstance=008dc2fffa48bde7;transport=tls",
"ContactID": "2339408900186963433",
"Expires": 351,
"Q": "",
"Callid": "104875NjQ4YzU5ZjA4YzQ1MTg1NzQ3OTgzMDEyMTQ1NTkxODg",
"Cseq": 582,
"User-agent": "SF 6.2.2.0 stamp 104875",
"Received": "sip:192.168.6.4:38431;transport=tls",
"State": "CS_SYNC",
"Flags": 0,
"Cflags": "SIP_PING NAT",
"Socket": "tls:10.10.10.133:5061",
"Methods": 5951
}
}
This is my configuration...
input {
exec {
type => "register"
command => "/tmp/dump_users"
codec => "json"
interval => 30
}
}
filter {
json {
source => "message"
}
split {
field => "[message][Domains][AORs]"
}
dissect {
mapping => {"AOR" => "%{anexo}@%{dominio}"}
}
}
Now i'm getting erros like:
Only String and Array types are splittable. field:[message][Domains][AORs] is of type = NilClass
Jun 7 19:16:55 sbcar logstash: [2021-06-07T19:16:55,672][WARN ][org.logstash.dissect.Dissector][main][6860af3126033566880a5e3957363dfe4962009218f4a979c674a1725c4e1590] Dissector mapping, field not found in event
Hope someone can help me.
Thanks!