Hi all,
The boundary of the logs: date and user. Total logs is more than 1000 logs.
Assuming you got field _time with full timestamp and field User, give this a try. Query 3 before last where clause actually gives data for all three. You just need to add appropriate table command afterwards.
For 1
your base search with field _time and User
| eval currentDate=strftime(_time,"%m/%d/%y")
| eval currentTime=strftime(_time,"%H:%M:%S")
| sort 0 currentDate User currentTime
| stats list(currentTime) as "List Times" by currentDate User
For 2
your base search with field _time and User
| eval currentDate=strftime(_time,"%m/%d/%y")
| eval currentTime=strftime(_time,"%H:%M:%S")
| sort 0 currentDate User currentTime
| streamstats current=f window=1 values(_time) as prev_time by currentDate User
| eval duration=round((_time-prev_time)/3600)
| stats list(currentTime) as "List Times" list(duration) as "Duration in hours" by currentDate User
For 3
your base search with field _time and User
| eval currentDate=strftime(_time,"%m/%d/%y")
| eval currentTime=strftime(_time,"%H:%M:%S")
| sort 0 currentDate User currentTime
| streamstats current=f window=1 values(_time) as prev_time by currentDate User
| eval duration=round((_time-prev_time)/3600)
| stats list(currentTime) as "List Times" list(duration) as "Duration in hours" sum(duration) as "Total Duration" by currentDate User | where 'Total Duration'>10
| stats count
Assuming you got field _time with full timestamp and field User, give this a try. Query 3 before last where clause actually gives data for all three. You just need to add appropriate table command afterwards.
For 1
your base search with field _time and User
| eval currentDate=strftime(_time,"%m/%d/%y")
| eval currentTime=strftime(_time,"%H:%M:%S")
| sort 0 currentDate User currentTime
| stats list(currentTime) as "List Times" by currentDate User
For 2
your base search with field _time and User
| eval currentDate=strftime(_time,"%m/%d/%y")
| eval currentTime=strftime(_time,"%H:%M:%S")
| sort 0 currentDate User currentTime
| streamstats current=f window=1 values(_time) as prev_time by currentDate User
| eval duration=round((_time-prev_time)/3600)
| stats list(currentTime) as "List Times" list(duration) as "Duration in hours" by currentDate User
For 3
your base search with field _time and User
| eval currentDate=strftime(_time,"%m/%d/%y")
| eval currentTime=strftime(_time,"%H:%M:%S")
| sort 0 currentDate User currentTime
| streamstats current=f window=1 values(_time) as prev_time by currentDate User
| eval duration=round((_time-prev_time)/3600)
| stats list(currentTime) as "List Times" list(duration) as "Duration in hours" sum(duration) as "Total Duration" by currentDate User | where 'Total Duration'>10
| stats count
Hi,
Do you mind explaining the sort and streamstats that you did there? It works, but I still don't understand what you did.
Thanks!
The sort command does sort the event based on specified field, so for every day, every users, it'll list the events in ascending order of time for that day. This is required so that in streamstats, I would be able to grab the value of timestamp of first event in the second event (you can just see what it does by executing search before streamstats, see how the data looks and then add streamstats command). Basically if you're data was like this (after sort)
_time user
00:00 A
01:00 A
02:00 A
Steamstats will give output like this (adding a new column to result set
_time user prev_time
00:00 A <<it will be blank/null>>
01:00 A 00:00
02:00 A 01:00