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!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...