Splunk Search

Eval If - count one item against sum total of the rest of the items in the group

user93
Communicator

Hi,

So I a page with more than a few urls that represent that same page. However, one of these urls has a value that indicates it has a specific location that indicates promotion. I want to chart on a line graph both the promoted url and all urls that are not the promoted url.

I figure I have to use the eval if statement, but what I've done thus far is not working.

page=/store/product_abcd1234* -> note this returns many variants of the same page
|eval promostatus=if(page="/store/product_abcd1234?source=promoted, promo, nopromo)
|chart distinctcount(user) by promostatus

I want to count uniquely the number of users who had a referral from the promotion and the number of users who load the entire group of page values (except the promo). I'd like to chart this over time with both lines on the same time graph.

0 Karma

to4kawa
Ultra Champion
...
| rex field=page "source=(?<page_source>[^,&\?]+"
| eval page_source = if(page_source="promo", "promo", "nopromo")
| timechart usenull=f useother=f dc(user) by page_source

Selecting url, search these.

0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...