Splunk Search

Run the condition on multiple fields of each events

khojas02
Engager

I have set of events as below:

EmployeeID Company
C123 ABC
C456 DEF
C789
2598
3648

Here, all the EmployeeID starting with C are Contractors and some of them have Company values. Now I want to achieve 2 things
1. I want to Populate "Unknown" where the EmployeeID starts with C but there is no Company value.
2. And for all the other EmployeeID (not starting with C), I want to populate Fulltime.

Thanks in advance!!

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

This should help.

... | eval Company = case(isnotnull(Company), Company, match(EmployeeID, "C.*"), "Unknown", 1==1, "Fulltime")
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

This should help.

... | eval Company = case(isnotnull(Company), Company, match(EmployeeID, "C.*"), "Unknown", 1==1, "Fulltime")
---
If this reply helps you, Karma would be appreciated.
0 Karma

khojas02
Engager

Thanks a lot, it worked for me.

I was trying to implement nested loop but it was giving me an error about malformed function or repeatable action. Thanking again for help!!

0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...