Splunk Search

Stats Count(Eval) doesn't return expected result

Luckless
Engager

I have this test search (I know the result is not all that useful, just playing with eval and trying to figure out what I'm doing wrong):

source="a" 
| transaction  subOrderId orderId startswith="startOrderProcessing" endswith="endOrderProcessing" maxevents=-1 maxspan=10m 
| stats count count(eval(subOrderName=="AddSubscriber")) as adds by subOrderName

Here is the resulting stats:

subOrderName        count   adds

AddSubscriber         16       0
DeleteSubscriber        6      0
Reconnect              1       0
ValidatePortability      3     0 

So I can tell stats sees the subOrderName field and that it can properly count how many of each transaction is processing. Why is the first row's last column not populated??? Is my understanding of count(eval) incorrect?

After I get this working, my end goal is to find the net adds (in this case, net adds would be 10).

Tags (3)
0 Karma
1 Solution

Luckless
Engager

So, I actually figured it out and may have found a splunk bug.

For everyone's info, I actually did scrub some of the info in my search for business purposes. All of my fields are set up like order.subOrderId, order.subOrderName, order.orderId.

It seems that eval in stats doesn't response well to fields with that dot format. When I changed my query to rename the field:

 source="a"
| rename order.subOrderName as subOrderName
| transaction order.subOrderId order.orderId startswith="startOrderProcessing" endswith="endOrderProcessing" maxevents=-1 maxspan=10m
| stats count count(eval(subOrderName=="AddSubscriber")) as adds by subOrderName

It worked because I was no longer using dotted field names.

View solution in original post

Luckless
Engager

So, I actually figured it out and may have found a splunk bug.

For everyone's info, I actually did scrub some of the info in my search for business purposes. All of my fields are set up like order.subOrderId, order.subOrderName, order.orderId.

It seems that eval in stats doesn't response well to fields with that dot format. When I changed my query to rename the field:

 source="a"
| rename order.subOrderName as subOrderName
| transaction order.subOrderId order.orderId startswith="startOrderProcessing" endswith="endOrderProcessing" maxevents=-1 maxspan=10m
| stats count count(eval(subOrderName=="AddSubscriber")) as adds by subOrderName

It worked because I was no longer using dotted field names.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...