Splunk Search

is it possible to have expression in case command for argument Y?

billchen99k
Engager

is it possible to have expression in case command for argument Y?

case(x,y)

|eval test=case(x=="X", 'a+b') 

The Y argument, instead of a strings or number, can it be an expression like field a + field b?

 

Thanks

 

 

Labels (1)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The Y argument can be anything valid for an eval statement.  IOW, if

| eval test=Y

works then

| eval test=case(X, Y)

should also work.

---
If this reply helps you, Karma would be appreciated.

billchen99k
Engager

Thank you for reply. I did a simple test on simple text event data and |eval test=case(x=="X", a+b) does work.

 

richgalloway
SplunkTrust
SplunkTrust

If your problem is resolved, then please click the "Accept as Solution" button to help future readers.

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

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 ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...