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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...