Shawcs
(Thor)
November 29, 2018, 4:56pm
1
Hi,
how could I detect when an array in a json is empty with logstash ?
example:
EMPTY
"serviceContexts": [
]
FULL:
"serviceContexts": [{
"service": "JIRA",
"monitor": true,
"client": null,
"org": null,
"app": null,
"method": "KeyGet",
"status": "failure",
"duration": 1
}
]
1 Like
guyboertje
(Guy Boertje)
December 7, 2018, 10:54am
2
if [serviceContexts] and [serviceContexts][0] {
# array has at least one element
} else {
# array has no elements
}
3 Likes
Shawcs
(Thor)
December 7, 2018, 1:59pm
3
Yes this is what I come up with. Wasn't sure if that was the best way to do it.
Thanks
system
(system)
Closed
January 4, 2019, 1:59pm
4
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.