Getting Data In

spath error parsing data

Marco_Andreis
New Member

Hi ,
I have this issue when try to parse with json. For example i evaluate a field (for example) a_configuration :
index="xxx" a_appl_id=YYY |
| eval a_configuration="[[\"A1\",\"A2\"],[\"B1\",\"B2\"],[\"C1\",\"C2\"],[\"D1\",\"D2\"],[\"E1\",\"E2\"],[\"F1\",\"F2\"],[\"G1\",\"G2\"]]"
| eval a_FieldX1=spath(a_configuration,"{0}{1}")
| eval a_FieldX2=spath(a_configuration,"{1}{1}")
| eval a_FieldX3=spath(a_configuration,"{2}{1}")
| eval a_FieldX4=spath(a_configuration,"{3}{1}")
| eval a_FieldX5=spath(a_configuration,"{4}{1}")
| eval a_FieldX6=spath(a_configuration,"{5}{1}")
| eval a_FieldX7=spath(a_configuration,"{6}{1}")
| table a_configuration a_FieldX1 a_FieldX2 a_FieldX3 a_FieldX4 a_FieldX5 a_FieldX6 a_FieldX7
the result expected is :
alt text
but the result is :
alt text
Can anyone teach me why ?
Thanks to all ...

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@Marco.Andreis@unicredit.eu

Can you please try this?

| makeresults 
| eval a_configuration="[[\"A1\",\"A2\"],[\"B1\",\"B2\"],[\"C1\",\"C2\"],[\"D1\",\"D2\"],[\"E1\",\"E2\"],[\"F1\",\"F2\"],[\"G1\",\"G2\"]]"
| eval a_FieldX1=mvindex(spath(a_configuration,"{0}{}"),0)
| eval a_FieldX2=mvindex(spath(a_configuration,"{1}{}"),0)
| eval a_FieldX3=mvindex(spath(a_configuration,"{2}{}"),0)
| eval a_FieldX4=mvindex(spath(a_configuration,"{3}{}"),0)
| eval a_FieldX5=mvindex(spath(a_configuration,"{4}{}"),0)
| eval a_FieldX6=mvindex(spath(a_configuration,"{5}{}"),0)
| eval a_FieldX7=mvindex(spath(a_configuration,"{6}{}"),0)
| table a_configuration a_FieldX1 a_FieldX2 a_FieldX3 a_FieldX4 a_FieldX5 a_FieldX6 a_FieldX7
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@Marco.Andreis@unicredit.eu

I'm also surprised about that. It should work. Well' I think your issue is resolved. So can you please accept this answer to close this question?

0 Karma

Marco_Andreis
New Member

Thanks . With your syntax the result is what I'm expect. I haven't understand why in same fields are loaded more than one value , but yor command fix this issue.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...