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 Enterprise Security 8.0.2 Availability: On cloud and On-premise!

A few months ago, we released Splunk Enterprise Security 8.0 for our cloud customers. Today, we are excited to ...

Logs to Metrics

Logs and Metrics Logs are generally unstructured text or structured events emitted by applications and written ...

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...