Getting Data In

How to parse array to get only required attribute?

Techie
Engager

Hello,

I have an array of timeline event.

Timeline[ [-]
       { [-]
         deltaToStart788
         startTime2023-02-01T21:56:11Z
         typeservice1
       }
       { [-]
         deltaToStart653
         startTime2023-02-01T21:56:11.135Z
         typeservice2
       }

     ]

I would like to table deltaToStart value only of type service1. 

 

Thanks.

Labels (1)
0 Karma

Techie
Engager

@ITWhisperer , thanks for responding.  Can you also help me to calculate sum of both durations and table all 3 fields (message.duration, deltaToStart, total_time)

total_time = message.duration + deltaToStart (of type service1)

message: { [-]
duration: 182
Timeline: [ [-]
{ [-]
deltaToStart: 788
startTime: 2023-02-01T21:56:11Z
type: service1
}
{ [-]
deltaToStart: 653
startTime: 2023-02-01T21:56:11.135Z
type: service2
}
]
}

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What have you tried so far?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| spath Timeline{} output=Timeline
| mvexpand Timeline
| spath input=Timeline
| where type="service1"
| table deltaToStart
0 Karma
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...