Dashboards & Visualizations

Help on Time / Chart / Span on a Single Value for a trend

LizAndy123
Path Finder

So I have a query which returns a value over a period of 7 days

 

The below is like the query but took a few items out

 

index=xxxx search xxxxx | rex field=_raw "projects/\\s*(?<ProjectID>\d+)" | rex field=_raw "HTTP\/1\.1\ (?P<Status_Code>[^\ ]*)\s*(?P<Size>\d+)\s*(?P<Speed>\d+)" | eval MB=Size/1024/1024 | eval SecTM=Speed/1000 | eval Examplefield=case(SecTM<=1.00, "90%")| stats count by Examplefield | table count

I can get the single value over 7 days

I want to be able to do like a comparaison over the previous 7 days

So lets number is 100,000 and prevous week was 90,000 then it shows up 10,000 or vice versa if that makes sense.
I have seen the Sample Dashboard with Single Value with an arrow going up or down but I just have no clue how to syntax the time bit

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

If you want a single value display with a trend arrow then you need a timechart command in the query.

index=xxxx search xxxxx 
| rex field=_raw "projects/\\s*(?<ProjectID>\d+)" 
| rex field=_raw "HTTP\/1\.1\ (?P<Status_Code>[^\ ]*)\s*(?P<Size>\d+)\s*(?P<Speed>\d+)" 
| eval MB=Size/1024/1024 
| eval SecTM=Speed/1000 
| eval Examplefield=case(SecTM<=1.00, "90%")
| timechart span=7d count

For comparison in a table, replace the timechart command with timewrap.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

If you want a single value display with a trend arrow then you need a timechart command in the query.

index=xxxx search xxxxx 
| rex field=_raw "projects/\\s*(?<ProjectID>\d+)" 
| rex field=_raw "HTTP\/1\.1\ (?P<Status_Code>[^\ ]*)\s*(?P<Size>\d+)\s*(?P<Speed>\d+)" 
| eval MB=Size/1024/1024 
| eval SecTM=Speed/1000 
| eval Examplefield=case(SecTM<=1.00, "90%")
| timechart span=7d count

For comparison in a table, replace the timechart command with timewrap.

---
If this reply helps you, Karma would be appreciated.
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...