Splunk Search

problem with using of CASE results

iKate
Builder

Hi everyone!

Could you please tell me why my search doesn't work.
It has variable click.value $offer_var$ that can be one of the several offer names. Each offer has distinct value of times that a user can exploit it. I need to figue out how many users have reached the maximum value.

source="my_source", service_id="my_service_id" tx_status_id=COMPLETED | fillnull value=none offer_uid | where offer_uid=$offer_var$ | eval max_usage=case(offer_uid == "free_winter", 2, offer_uid == "free_summer", 15, offer_uid == "free_spring", 10) | stats count as usage by user_uid | stats count(eval(usage = max_usage)) as used_offer_completely

For testing purposes I put the name of one of the offers instead of $offer_var$.
Search shows 0 for used_offer_completely but the real result should be other.

Tags (3)
0 Karma
1 Solution

iKate
Builder

I've stumbeled upon my old question and realized that I should change the query as follows:

source="my_source", service_id="my_service_id" tx_status_id=COMPLETED | fillnull value=none offer_uid | where offer_uid=$offer_var$ | eval max_usage=case(offer_uid == "free_winter", 2, offer_uid == "free_summer", 15, offer_uid == "free_spring", 10) | eventstats count as usage by user_uid | stats count(eval(usage = "max_usage")) as used_offer_completely

View solution in original post

0 Karma

iKate
Builder

I've stumbeled upon my old question and realized that I should change the query as follows:

source="my_source", service_id="my_service_id" tx_status_id=COMPLETED | fillnull value=none offer_uid | where offer_uid=$offer_var$ | eval max_usage=case(offer_uid == "free_winter", 2, offer_uid == "free_summer", 15, offer_uid == "free_spring", 10) | eventstats count as usage by user_uid | stats count(eval(usage = "max_usage")) as used_offer_completely

0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...