Splunk Search

How to calculate statistics for using PC

ipoluda
Explorer

Hello!
I have a log that shows locking/unlocking PCs:

1710320306,u09,unlocked
1710320356,u09,locked
1710320360,u10,unlocked
1710320363,u10,locked
1710320369,u11,unlocked
1710320374,u11,locked
1710320379,u09,unlocked
1710320384,u09,locked
1710320389,u10,unlocked
1710321119,u10,locked
1710321126,u11,unlocked
1710322754,u11,locked
1710322760,u09,unlocked
1710324580,u09,locked
1710326550,u09,unlocked
1710328364,u09,locked

The first field - unix timestamp, second - user, third - action.

I need to get a statistics for PCs beeing unlocked by users. So it will the sum of seconds between unlocked-locked actions for each user. Please, help with search query

Labels (1)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

one way it use command transaction like

| makeresults format=csv data="_time,user,action
1710320306,u09,unlocked
1710320356,u09,locked
1710320360,u10,unlocked
1710320363,u10,locked
1710320369,u11,unlocked
1710320374,u11,locked
1710320379,u09,unlocked
1710320384,u09,locked
1710320389,u10,unlocked
1710321119,u10,locked
1710321126,u11,unlocked
1710322754,u11,locked
1710322760,u09,unlocked
1710324580,u09,locked
1710326550,u09,unlocked
1710328364,u09,locked"
| transaction startswith="action=unlocked" endswith="action=locked" user
| fieldformat duration=tostring(duration,"duration")

r. Ismo

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...