Splunk Search

Unable to subtract one days hours from previous days to create TimeChart

keezy713
Loves-to-Learn

I am trying to create a Timechart that will list out the TotalHours of that day and then subtract the previous days TotalHours to see the Hours difference in each day. This needs to span 14 days  

Basically I just need the Total Hours difference from One day to the next spanned across a timechart 

This is the data and Query I have so far (not much)

-------Search-----
| where TotalHours != "0" AND _time>relative_time(now(), "-14d@d")
| dedup PROJECT_NUMBER _time
| table PROJECT_NUMBER TotalHours _time
| sort by PROJECT_NUMBER

keezy713_0-1637080919559.png

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| sort 0 PROJECT_NUMBER _time
| streamstats values(TotalHours) as previousTotalHours current=f window=1 by PROJECT_NUMBER
| eval diff=previousTotalHours-TotalHours
0 Karma

keezy713
Loves-to-Learn

Below is the query that I have now 

Search
|table PROJECT_NUMBER _time TotalHours
| sort 0 PROJECT_NUMBER _time
| streamstats values(TotalHours) as previousTotalHours current=f window=1 by PROJECT_NUMBER
| eval diff=previousTotalHours-TotalHours

keezy713_0-1637084938230.png

Im trying to see if I can get just the diff streamed out over a time period

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| xyseries _time PROJECT_NUMBER diff
0 Karma

keezy713
Loves-to-Learn

This is what I'm getting now.

I think its just populating from all the Projects.

Is there a way to get all the project (sum) TotalHours and then subtract that from the previous days total of TotalHours and then set x axis as _time and Y  axis as diff streamed across 2 weeks?

Again thanks for your help 

 

keezy713_0-1637086654484.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| timechart sum(diff) as Total
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...