Hi !
I strongly apologize for a possibly stupid, kinda "it-has-been-asked-a-lot-of-time", question. Nevertheless I have to ask for help because I have completely stuck with .
So that I have a JSON array consist of objects looks like
"data": [
{ "iso.org.dod.internet.experimental.94.1.8.1.7": 8, "index": "32.128.0.192.255.39.112.187.0.0.0.0.0.0.0.0.1", "iso.org.dod.internet.experimental.94.1.8.1.4": 3, "iso.org.dod.internet.experimental.94.1.8.1.6": "On-Board Temperature 1-Ctlr A: 22 C 71.60F", "iso.org.dod.internet.experimental.94.1.8.1.3": "On-Board Temperature 1-Ctlr A" },
{ "iso.org.dod.internet.experimental.94.1.8.1.7": 8, "index": "32.128.0.192.255.39.112.187.0.0.0.0.0.0.0.0.2", "iso.org.dod.internet.experimental.94.1.8.1.4": 3, "iso.org.dod.internet.experimental.94.1.8.1.6": "On-Board Temperature 1-Ctlr B: 23 C 73.40F", "iso.org.dod.internet.experimental.94.1.8.1.3": "On-Board Temperature 1-Ctlr B" },
{ "iso.org.dod.internet.experimental.94.1.8.1.7": 8, "index": "32.128.0.192.255.39.112.187.0.0.0.0.0.0.0.0.3", "iso.org.dod.internet.experimental.94.1.8.1.4": 3, "iso.org.dod.internet.experimental.94.1.8.1.6": "On-Board Temperature 2-Ctlr A: 25 C 77.00F", "iso.org.dod.internet.experimental.94.1.8.1.3": "On-Board Temperature 2-Ctlr A" }, ]
Accordingly to my needs I have to make a next set of operations with every member of the array
- enrich every one with some additional fields
- remove an "index" field
- set a human-readable name for a fields with MIB-like names
- get a performance value from a status string (e.g. Temp=22 for a first member)
I would be able to do it if I split this array by doing
filter{ split {field =>"[data"}}
Yess...but there is an little thing , that [data] array holds almost 200 members. So that I obtain almost 200 documents ready to convert . Really ready, here is a one of them as a result
"instance": "128_128",
"s_string": "On-Board Temperature 1-Ctlr A: 22 C 71.60F",
"serialno": "5R6693C077",
"@timestamp": "2021-02-16T11:06:58.229Z",
"object": "MSA_2050",
"name": "On-Board Temperature 1-Ctlr A",
"s_status": "3",
"Temp": 22,
"location": "ArcDC",
"parentname": "board"
Actually, getting almost 200 documents instead of one every time I get a query from logstash, looks weird 8( to me 8) personally to me 8).
I strongly suspect that if I tried to put data on a that way into my ES index I would get a trouble sooner or later.
So let me ask you.
Is there a way to do that without splitting ? How can I deal with my array to do all the conversions inside ? I have known about ruby code, but I see "no wall to lean on" literally (I am the complete teapot in Ruby ) . Wouldn't you be so kind to show me the point to start from ?
Any help would be appreciated
Thanks a lot in advance.