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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...