Splunk Search

How do i get a % of page hits off the total users who accessed a set of pages.

abhijitd
New Member
index=app sourcetype=accesslog uri="some uri" user!="-"  (context="display" OR context="pages") earliest=-7d | rex field=page ^"(?<spacekey_or_action>\S+)(\/|\?|spaceKey\=|draftId\=|pageId\=|key\=)|(?<pid_or_sk>[0-9|a-z|A-Z|\+\%\-\:\(\)\.]{1,})|\&(?<article>\S+)" max_match=0 | search spacekey_or_action="123" OR (spacekey_or_action="viewpage.action" AND pid_or_sk="123")
|  stats dc(user) as users by page 
|  sort -users
|  eventstats sum(users) as totalUsers

I get the display as :

  1. Page1 100 150
  2. Page2 50 150

Basically, my question is how do i get a % so Page 1 is 66% of total events and Page 2 is 33% of total events and so on

The base rex and this followup rex searches all pages for the content group 123.

Tags (1)
0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

@abhijitd ,

Just add this to your search

  | eval perc=round((users/totalUsers)*100,2)
Happy Splunking!

View solution in original post

0 Karma

abhijitd
New Member

Thanks! this worked.

0 Karma

renjith_nair
SplunkTrust
SplunkTrust

@abhijitd ,

Just add this to your search

  | eval perc=round((users/totalUsers)*100,2)
Happy Splunking!
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...