Dashboards & Visualizations

Need help on Trend graph over time period

arunrajamani
New Member

Hi Team,

I need help on creating a trend graph with respect to pass/fail transaction for an application for automation test result.
Sample Json:

{
"environment":"Env",
"business scenario":"Business Scenario1",
"triggered-at":"2019-10-28T21:45:33Z",
"scenarioData":[
{
"application":"Application1",

     "scenario":"Place an order for Existing user in Application",
     "started-at":"2019-10-28T21:45:33Z",
     "type":"UI",
     "finished-at":"2019-10-28T21:48:10Z",
     "steps":[ 
        { 
           "stepName":"Login to application url",
           "stepId":"111",
           "fullName":"111 Login to application url",
           "stepduration":"93472877349",
           "status":"passed"
        },
        { 
           "stepName":"click on Add to cart",
           "stepId":"112",
           "fullName":"112 click on Add to cart",
           "stepduration":"46651966242",
           "status":"failed"
        },
        { 
           "stepName":"And user clicks on View Cart button from popup window",
           "stepId":"113",
           "fullName":"113 And user clicks on View Cart button from popup window",
           "stepduration":"null",
           "status":"skipped"
        },
        { 
           "stepName":"And user verifies cart summary and clicks on Buy Now button",
           "stepId":"114",
           "fullName":"114 And user verifies cart summary and clicks on Buy Now button",
           "stepduration":"null",
           "status":"skipped"
        },
        { 
           "stepName":"Then application should display login page for current customer",
           "stepId":"115",
           "fullName":"115 Then application should display login page for current customer",
           "stepduration":"null",
           "status":"skipped"
        }
     ],
     "status":"FAIL",
     "duration-ms":"156942"
  }
Tags (1)
0 Karma

arunrajamani
New Member

alt text

0 Karma

arunrajamani
New Member

Hello Adonio,

Thank you very much for your reply!!

Actually i need to create a application availability trend graph with last 30 days data and it should plot like last 4 weeks data.

Calculated application availability with below query

index=cucumber
| spath
| rename triggered-at as StartTime
| spath path=scenarioData{}

| mvexpand scenarioData{}

| spath input=scenarioData{}

| rename "business scenario" as BusinessScenario,application as Application, status as AppStatus
| eval string1=mvzip(Application,AppStatus,"sep_")
| mvexpand string1
| rex field=string1 "(?.)sep_"
| rex field=string1 "sep_(?.
)"

| eval epoche=strptime(StartTime,"%Y-%m-%dT%H:%M:%SZ")

| eval c_time=strftime(epoche,"%H:%M")
|search BusinessScenario="" AND Application=""

| eval total_attempts=0
| foreach : [eval total_attempts=total_attempts+1]

| eval total_pass=0
| foreach : [eval total_pass=total_pass + if('<>'=="PASS", 1, 0) ]

| eval total_fail=0
| foreach : [eval total_fail=total_fail + if('<>'=="FAIL", 1, 0) ]
| eval Availability_Index = (total_pass/total_attempts)*100
| fields - total_pass total_fail total_attempts

|timechart span=1w count(Availability_Index) by Application

Need a proper query to plot the trend graph with respect to application

Attached the expected trend graph.

Kindly help!!

Cheers,
Arun

0 Karma

adonio
Ultra Champion

what is the anticipated outcome?
what are you looking to get out of the query and your data?
what do you mean by trend graph pass fail?
uploaded the file with sourectpye=_json
this is what i get with this quick search:

index=... sourcetype=_json ...
| rename scenarioData{}.steps{}.* as *
| table  step* status

screenshot:
alt text

is that the right direction?

hope it helps

0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...