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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...