Getting Data In

How to plot timechart on elapsed time from json array object?

hungrykakarot
Explorer

Hi,

 

I have an application(test.app) which invokes multiple downstream application apis(profile, payments etc) and we log elapsed time of every downstream call as an element of Json Array. Is it possible to plot timechart on the p99(elapsed) time of each downstream application call separately.

 

Sample log : 

 

 

{
......
appName : test.app
downstreamStats : [
  {
    ...
    pathname : profile,
    elapsed: 250,
    ...
  },
  {
    ...
    pathname : payments,
    elapsed: 850,
    ...
  }
]
......
}

 

 

 

I want to plot timechart of the above logs with p99 of elapsed time BY pathname

Labels (4)
0 Karma
1 Solution

hungrykakarot
Explorer

Seems i got it :

 

index=test.index appName=test.app | spath downstreamStats | search downstreamStats{}.pathname!=null |eval x=mvzip('downstreamStats{}.pathname','downstreamStats{}.elapsed',"#") | mvexpand x | rex field=x "(?<ds_path>\w+)#(?<ds_elapsed>\d+)"  | timechart span=1m p99(ds_elapsed) by ds_path


This works

View solution in original post

0 Karma

hungrykakarot
Explorer

Seems i got it :

 

index=test.index appName=test.app | spath downstreamStats | search downstreamStats{}.pathname!=null |eval x=mvzip('downstreamStats{}.pathname','downstreamStats{}.elapsed',"#") | mvexpand x | rex field=x "(?<ds_path>\w+)#(?<ds_elapsed>\d+)"  | timechart span=1m p99(ds_elapsed) by ds_path


This works

0 Karma

hungrykakarot
Explorer

I tried below but it didnt work :

 

index=test.index appName=test.app | spath downstreamStats | search downstreamStats{}.pathname!=null | eval x=mvzip('downstreamStats{}.pathname','downstreamStats{}.elapsed',"#") | mvexpand x | rex field=x "(?<ds_path>)#(?<ds_elapsed>)" | timechart span=1m p99(ds_elapsed) by ds_path

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Extract the collection as a complete object, extract the items from the collection, mvexpand to create events for each item, extract the pathname and elapsed fields, plot your chart.

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...