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 Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...