Splunk Search

Why can't I search field values created in eval?

michaeler
Communicator

I have a field called "Node_ID" that I extracted from another field "issue" that is formatted as N1234. There were some events that didn't fit and couldn't extract normally so I used eval to identify them.

| eval Node_ID=if(like(issue, "WC SVR%"), "WC SVR", Node_ID), Node_ID=if(like(issue, "EU SVR%"), "EU SVR", Node_ID), Node_ID=if(like(issue, "SE SVR%"), "SE SVR", Node_ID), Node_ID=if(like(issue, "NE SVR%"), "NE SVR", Node_ID)

This does what I want and adds those values to the field Node_ID but when I try to search by one of them:

| search Node_ID="WC SVR"

I get zero results even though I can see there are 4 events when looking at the field in the sidebar. Is there a reason behind this?

** Any suggestions to do this another way are always appreciated**

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Looks like a bug - try like this:

| eval Node_ID=if(like(issue, "WC SVR%"), "WC SVR", Node_ID)
| eval Node_ID=if(like(issue, "EU SVR%"), "EU SVR", Node_ID)
| eval Node_ID=if(like(issue, "SE SVR%"), "SE SVR", Node_ID)
| eval Node_ID=if(like(issue, "NE SVR%"), "NE SVR", Node_ID)
| where Node_ID=="WC SVR"

or this

| eval Node_ID=case(like(issue, "WC SVR%"), "WC SVR", like(issue, "EU SVR%"), "EU SVR", like(issue, "SE SVR%"), "SE SVR", like(issue, "NE SVR%"), "NE SVR") 
| search Node_ID="WC SVR"
0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...