Dashboards & Visualizations

Count only events that appear more than once

rsAU
Explorer

I want to count user_ids that appear more than once per month. (ie a user that has used the product multiple times). 

I've tried a few variations such as :
search XXX | dedup XXX | stats count by user_id | where count >1

but can't seem to get it to work. Hoping to be able to display the count as a single number as well as timechart it so I can show the number over the last X months..

Any suggestions? It feels like it should've been easier than it has been!

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

It is not clear what the dedup is doing, nor what the search XXX is for, but let's assume it is for the product you are interested in. Next, it isn't clear what the single would show. Is it how many users have used the product multiple times?

| bin _time span=1mon
| stats count by _time user_id
| where count > 1
| timechart count span=1mon

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

It is not clear what the dedup is doing, nor what the search XXX is for, but let's assume it is for the product you are interested in. Next, it isn't clear what the single would show. Is it how many users have used the product multiple times?

| bin _time span=1mon
| stats count by _time user_id
| where count > 1
| timechart count span=1mon

rsAU
Explorer

Thanks heaps! I knew it was going to be something simple like that. 

Appreciate your help. Cheers

0 Karma

inventsekar
SplunkTrust
SplunkTrust

Hi @rsAU 

The above reply should work fine for your situation. 

if still any issues, pls update us 

1) your full search query (remove any confidential info)

2) maybe a screenshot is better 

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @rsAU ,

let me understand:

you want to count the users that accessed the system more than one time, is this correct?

You can use a simple search:

<your_search>
| stats count by user_id 
| where count>1

Ciao.

Giuseppe

rsAU
Explorer

Thanks Giuseppe - that worked for the single value! I'm pretty sure I had tried it already, but I was probably trying to over-engineer it. 

Cheers

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...