Splunk Search

How can I separate count eval results into individual rows depending on the data found?

Steve_A200
Path Finder

Hi,

Currently, my query produces the correct results but they are all aggregated into single cells, and I would like to have them separated depending on the results found.

What I would like is to have "Offers/Redeemed/Take_Rate"  listed and calculated for each unique combination of results found for pointBank/merchant.  

So:

offers  Redeemed  Pointbank   Merchant   Take_Rate

2               1                    A                       A                 50

3               1                    A                       B                 33.3

6               3                    B                       A                 50

5               1                    B                       C                 20

My current query is:

host="server" source="/home/xyz.log" earliest=-1@d latest=now | fields "promotionAction" "pointBankCode" "merchantCode"| search (promotionAction="*") pointBankCode="*" merchantCode="*" | stats count(eval(promotionAction= "OFFERED")) AS Offers count(eval(promotionAction= "ACCEPTED")) as Redeemed values(pointBankCode) as PointBank values(merchantCode) as Merchant | eval Take_Rate=((Redeemed)/(Offers)*100)

Labels (2)
Tags (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
host="server" source="/home/xyz.log" earliest=-1@d latest=now 
| fields "promotionAction" "pointBankCode" "merchantCode"
| search (promotionAction="*") pointBankCode="*" merchantCode="*" 
| stats count(eval(promotionAction= "OFFERED")) AS Offers count(eval(promotionAction= "ACCEPTED")) as Redeemed by pointBankCode merchantCode 
| eval Take_Rate=((Redeemed)/(Offers)*100)

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
host="server" source="/home/xyz.log" earliest=-1@d latest=now 
| fields "promotionAction" "pointBankCode" "merchantCode"
| search (promotionAction="*") pointBankCode="*" merchantCode="*" 
| stats count(eval(promotionAction= "OFFERED")) AS Offers count(eval(promotionAction= "ACCEPTED")) as Redeemed by pointBankCode merchantCode 
| eval Take_Rate=((Redeemed)/(Offers)*100)

Steve_A200
Path Finder

Thank you very much for the prompt reply, that worked exactly how I needed it to display.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...