Splunk Search

how to get the case function to have multiple status, when multiple fields are true

spicy
Path Finder

The case function seems to finding the first true statement and displays that value. Is there another function or different way to use case to get the results i want below? There are different events with similar features below, want something that would use for all different scenarios of when something is true or false.

Event Fields i am filtering on:
vpn=true
proxy=false
tor=true

What im using:
| eval anon= case(vpn="true", "vpn" , proxy="true", "proxy", tor="true", "tor")

results im getting:
anon=vpn 

results i want:
anon=vpn
             tor

thanks for any help!

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults
| eval vpn="true"
| eval proxy="false"
| eval tor="true"
| foreach vpn proxy tor
    [| eval anon=if(<<FIELD>>="true",if(isnull(anon),"<<FIELD>>",mvappend(anon,"<<FIELD>>")),anon)]

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults
| eval vpn="true"
| eval proxy="false"
| eval tor="true"
| foreach vpn proxy tor
    [| eval anon=if(<<FIELD>>="true",if(isnull(anon),"<<FIELD>>",mvappend(anon,"<<FIELD>>")),anon)]

spicy
Path Finder

Thanks! Gonna have to apply this knowledge to other queries now

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

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 ...