Splunk Search

Count number of user access the site

ndkhoiits
Explorer

I have 5 sites S1, S2, S3, S4, S5, I used splunk to monitor all requests to these sites. Now I want to statistic number of user who access site S1, S2, S3, S4, S5 per day. For example my data is

u1 accessed site s1

u1 accessed site s2

u1 accessed site s3

u2 accessed site s1

u1 accessed site s2

u2 accessed site s4

u3 accessed site s2

u1 accessed site s1

u1 accessed site s2

u3 accessed site s2

u4 accessed site s1

My expected report is:

S1 S2 S3 S4 S5
3 3 1 1 0



Even s1 was accessed 4 times, but number of user is 3. Same as other sites

How can I have this statistic with splunk 6.

Thank for any suggestion.

Tags (3)
0 Karma
1 Solution

gfuente
Motivator

Hello

You would need an authenticated username, or at least the clientip, on each of the logs. Then you just can use:

sourcetype=access_combined | stats dc(clientip) by source

Just as an example, change the values as necessary

regards

View solution in original post

somesoni2
Revered Legend

Assuming your data have fields user and site already extracted, you can use following to get list of unique users access these site per day.

your base search giving _time, user, site | timechart span=1d dc(user) by site
0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

Based on your events above:

your_search_for_events | rex field=_raw "(?<user>\w+)\saccessed\ssite\s(?<site>\w+)" | stats dc(user) by site

You may need to change the regex depending if things have special characters or not.

It would be even easier if you used a props/transform extraction to auto pull <user> and <site>.

gfuente
Motivator

Hello

You would need an authenticated username, or at least the clientip, on each of the logs. Then you just can use:

sourcetype=access_combined | stats dc(clientip) by source

Just as an example, change the values as necessary

regards

Get Updates on the Splunk Community!

What You Read The Most: Splunk Lantern’s Most Popular Articles!

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

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...