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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...