Splunk Search

Is it possible to write switch case statements in Splunk like other programming languages?

soumidutta
Explorer

Hi ,

Can it be possible to write switch case statements in Splunk like other programming languages?
If so, can you help me out with the syntax?

Tags (1)
0 Karma

renjith_nair
Legend

@soumidutta,

Yes , using eval - eval description=case(status == 200, "OK", status ==404, "Not found", status == 500, "Internal Server Error")

http://docs.splunk.com/Documentation/Splunk/7.2.0/SearchReference/ConditionalFunctions#case.28X.2C.2...

---
What goes around comes around. If it helps, hit it with Karma 🙂

soumidutta
Explorer

Thanks
I was looking for this one

0 Karma

renjith_nair
Legend

@soumidutta,
Please accept as answer if it helped you. thanks

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Announcing the General Availability of Splunk Enterprise Security 8.1!

We are pleased to announce the general availability of Splunk Enterprise Security 8.1. Splunk becomes the only ...

Developer Spotlight with William Searle

The Splunk Guy: A Developer’s Path from Web to Cloud William is a Splunk Professional Services Consultant with ...

Major Splunk Upgrade – Prepare your Environment for Splunk 10 Now!

Attention App Developers: Test Your Apps with the Splunk 10.0 Beta and Ensure Compatibility Before the ...