Greetings,
I have a dynamic JSON object which I would like to extract fields from it
This is sample on how the JSON object looks like
layers: {
tcap: [
{
otid: "12:23:34:45"
},
{
otid: "4h:2f:65:3g",
dtid: "h5:f3:v3:h5",
},
{
otid: "j7:f3:h5:k7"
}
]
gsm_map: [
{
e212_imsi: 45608730
},
{
e164_msisdn: 450968345390
},
{
}
]
}
the TCAP array might be a single object or array of objects while the content inside might have OTID or DTID.
Same goes to the GSM_MAP following the TCAP
I have few questions to solve my problem:
1) How do I use grok on dynamic object? It seems right now I have GROKPARSEFAILURE tag if no fields found
2) From the GSM_MAP, I might need to traverse the JSON object with regex. Something like "_e212_imsi" or "_e164_msisdn" as long as it ends with the "e212_imsi" or "e164_msisdn"
3) When I traverse for the OTID/DTID, seems I get only part of it. e.g: otid: "12:23:34:45", and my OTID is "12". It doesn't get the full string
4) If I manage to get my fields, how do I place it on the same hierarchy of JSON object? In this sample, I want to place it on "layers"
Right now, this if what I have which is far from what I wish for
grok {
match => {
"[layers][gsm_map][*_e212_imsi]" => "%{WORD:IMSI}$"
"[layers][gsm_map][*_e164_msisdn]" => "%{WORD:MSISDN}$"
"[layers][tcap][text_tcap_otid]" => "%{WORD:otid}$"
"[layers][tcap][text_tcap_dtid]" => "%{WORD:dtid}$"
"[layers][sccp][sccp_called_digits_sccp_digits]" => "%{WORD:sccp_called_digits_sccp_digits}$"
"[layers][sccp][sccp_calling_digits_sccp_digits]" => "%{WORD:sccp_calling_digits_sccp_digits}$"
}
}
mutate {
add_field => {
"layers" => {
"gsm_map" => {
"imsi" => "%{IMSI}"
"msisdn" => "%{MSISDN}"
}
"tcap" => {
"text_tcap_otid" => "%{otid}"
"text_tcap_dtid" => "%{dtid}"
}
"sccp" => {
"sccp_called_digits_sccp_digits" => "%{sccp_called_digits_sccp_digits}"
"sccp_calling_digits_sccp_digits" => "%{sccp_calling_digits_sccp_digits}"
}
}
}
}
Thanks in advance.