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!

Introducing New Splunkbase Governance!

Splunk apps are essential for maximizing the value of your Splunk Experience. Whether you’re using the default ...

Splunk Edge Processor | Popular Use Cases to Get Started with Edge Processor

Splunk Edge Processor offers more efficient, flexible data transformation – helping you reduce noise, control ...

3 Ways to Make OpenTelemetry Even Better

My role as an Observability Specialist at Splunk provides me with the opportunity to work with customers of ...