Splunk Search

How can I modify my search to filter and display only the first and second value?

pavanae
Builder

search :- My search | stats values(date_hour) as Access_time by user

The above search displays the user id with their accesses hour on the right. Now how can i display only the 1st value and last value of Access_time for each user.

Example if I have the result as below

user Access_time
A 16
18
19
22

Now I just want the first and last value of the Access_time as below

user Access_time
A 16 -- 22

0 Karma
1 Solution

cmerriman
Super Champion
My search | stats earliest(date_hour) as FirstHour latest(date_hour) as LastHour by user|eval accessTime=FirstHour+"--"+LastHour|fields - FirstHour - LastHour

try something like this.

View solution in original post

0 Karma

cmerriman
Super Champion
My search | stats earliest(date_hour) as FirstHour latest(date_hour) as LastHour by user|eval accessTime=FirstHour+"--"+LastHour|fields - FirstHour - LastHour

try something like this.

0 Karma

pavanae
Builder

Thanks for the responce. Now Can you help me calcullating the standard deviation for the last 7 days. Where standard_deviation is if accessTime is 3 times standard deviation of average?

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...