Splunk Search

Why are eval fields not in table?

Span
Engager

Hi,

Iam trying a simple query where i want to see the percentage of calls with a particular response time in splunk and somehow the percent field is coming as empty in the table.

 

index = xyz http_status=200 | stats count(request_ms) as web-calls by request_ms | eventstats sum(web-calls) as totalwb |eval percent=(web-calls*100/totalwb) | table request_ms web-calls totalwb percent

Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The problem is with the web-calls field name.  The eval command is computing percent as (web-(calls*100/totalweb)), but since the web and calls fields don't exist they can't be subtracted so the percent field can't be computed.  Percent is set to null and is displayed as an empty field.  This is why hyphens should not be used in field names.  If the hyphen can't be changed then surround the field name in single quotes ('web-calls') so Splunk knows it's a field rather than an expression.

---
If this reply helps you, an upvote would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The problem is with the web-calls field name.  The eval command is computing percent as (web-(calls*100/totalweb)), but since the web and calls fields don't exist they can't be subtracted so the percent field can't be computed.  Percent is set to null and is displayed as an empty field.  This is why hyphens should not be used in field names.  If the hyphen can't be changed then surround the field name in single quotes ('web-calls') so Splunk knows it's a field rather than an expression.

---
If this reply helps you, an upvote would be appreciated.
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...