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, Karma 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, Karma would be appreciated.
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...