Splunk Search

how can i calculate the average time range of DayOne,DayTwo,DayThree for each student_id?

pavanae
Builder

I have a splunk Query as below

earliest=-1d@d latest=@d index=abc | where date_hour>=15 OR date_hour<9 | stats earliest(date_hour) as FirstHour latest(date_hour) as LastHour by student_id|eval DayOne=FirstHour+" to "+LastHour| fields - FirstHour - FirstMinute - LastHour - LastMinute | appendcols [search earliest=-2d@d latest=-1d@d index=abc | where date_hour>=15 OR date_hour<9 | stats earliest(date_hour) as FirstHour latest(date_hour) as LastHour by student_id|eval DayTwo=FirstHour+" to "+LastHour| fields - FirstHour - FirstMinute - LastHour - LastMinute ] | appendcols [search earliest=-3d@d latest=-2d@d index=abc | where date_hour>=15 OR date_hour<9 | stats earliest(date_hour) as FirstHour latest(date_hour) as LastHour by student_id|eval DayThree=FirstHour+" to "+LastHour| fields - FirstHour - FirstMinute - LastHour - LastMinute ]| table student_id DayOne DayTwo DayThree

Which displays the result as below

student_id DayOne DayTwo DayThree
A123 22--24 19--23 20--22
B456 02--08 03--07 19--00

Hint 1 :- I have used 3 searches above which are same except for the fields DayOne,DayTwo,DayThree and earliest,latest times.

Note :- If calcullating average for this scenario isn't possible. Any ideas or suggestions would highly appriciate. Thank you.

Now how can i calculate the average time range of DayOne,DayTwo,DayThree for each student_id?

0 Karma

gokadroid
Motivator

Looks like the average calculation for your data set was already provided which you had accepted as an answer too, here:
https://answers.splunk.com/answers/475177/how-to-calculate-the-average-and-standard-deviatio.html

Also in this answer you have given a way to calculate the average yourself:
https://answers.splunk.com/answers/476004/how-to-compare-the-last-7-days-average-with-yester.html

Also as a comment to your scenario, you were not able to provide, what is the expected "average" that you wanted?
https://answers.splunk.com/answers/475177/how-to-calculate-the-average-and-standard-deviatio.html#co...

So unless you do not articulate what is meant by an average of the two dimensional data set that you provide then it might be hard to answer or to calculate it by community users.

0 Karma
Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...