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!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...