Splunk Search

Return command giving error for stats c(eval...) in splunk

snehalk
Communicator

Hello Everyone,

Am creating the dynamic query depending on condition and after that using return command to execute that search query string, below is my search query

   [ | search query which gives me dynamic string.... | return $myquery ]

where $myquery contain index=xyz | stats c(eval(eventtype="myeventtype1")) as "myeventtype1", c(eval(eventtype="myeventtype2")) as "myeventtype2"

but its giving me the error (actually its putting the each eventtype value while executing), is there any way where we can execute this query without any error?

Note: when i execute myquery string manually its perfectly working fine.

Can any on help me here?

Thank you

0 Karma

woodcock
Esteemed Legend

Why bother with the extra stuff; just do this ( search is a special field name returning from subsearches):

  [ | search query which gives me dynamic string.... | rename myquery AS search ]
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...