Splunk Search

How to get this eval statement to isolate the search to just two values?

msage
Path Finder

Working on a search where there's a field (Office Location) with about 5 different values that are stored in a lookup file. We're looking at attendance at a specific office (office 1) and differentiating who's actually going in. Specifically, we want to isolate people assigned to office 1 and those that are assigned to a different office. The original search looks like this but it would populate all the locations rather than just office 1 or not.

 

index=index EVDESCR="event" READERDESC="reader"
| lookup users.csv ID as EMPLOYEE_ID 
|timechart span=1d dc(CARDNUM) by Location limit=0

 

 

I tried using this eval statement to hopefully isolate the search to just two values. Yes, home office or no home office. 

 

 

|eval Home=if(Location"office1", yes, no) 

 

 

 The problem is this eval statement doesn't work and I'm not sure what I'm doing wrong. Any help is appreciated. 

Labels (4)
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| eval Home=if(Location="office1", "yes", "no") 

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| eval Home=if(Location="office1", "yes", "no") 

msage
Path Finder

Actually you were correct. Not having the quotation marks was what was giving me issues. 

0 Karma

msage
Path Finder

Tried that and it won't work for whatever reason. All the results are blank

0 Karma
Get Updates on the Splunk Community!

Index This | What did the zero say to the eight?

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

Splunk Observability Cloud's AI Assistant in Action Series: Onboarding New Hires & ...

This is the fifth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Now Playing: Splunk Education Summer Learning Premieres

It’s premiere season, and Splunk Education is rolling out new releases you won’t want to miss. Whether you’re ...