Splunk Search

How to create a table based if condition result?

Premkumarpalani
New Member

i wanna know how to display the result after specifying an if condition.
the sample search is like :

index=xyz | order="0000" | eval Order_status=if(order!=0,"found","not found") | .....

after this condition, if order=found, I need to display a table with few fields....please help me to solve this.

Tags (3)
0 Karma

MuS
Legend

Hi Premkumarpalanichamy,

something like this works perfect for me:

index=_internal  | head 1 | eval order="0000" | eval Order_status=if(order!="0","found","not found") | table Order_status order | where Order_status="found"

adapt it to your needs.

cheers, MuS

Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...