Splunk Search

Trying to create a new calculated field but the Eval expression is not evaluating correctly

trobknight7
Engager

Hi there, Splunk Community! First time poster! Whoo!

Let me outline the situation, goal, and problem faced briefly:
I have a field in a dataset called `detail.accountId` that is the number of an AWS Account ID. My goal is to create a calculated field called "AccountName" for each `detail.accountId` ID that would theoretically look something like this:
if(detail.accountId == "1234567890", "AccountX", "UnknownAccountName")

The problem I'm facing is the eval expression is always coming out False, resulting in the AccountName field column to always display"UnknownAccountName". No matter if I use tostring(detail.accountId), trim(detail.accountId), match(detail.accountId), etc in the eval expression comparison, it's always false when the value "1234567890" definitely exists as the detail.accountId.

Am I doing something incorrectly here that may be obvious to someone?

 

Thank you very much for the help!

Tyler

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Since the field name has a dot in it, which is used as a string concatenator, have you tried putting the field name in single quotes?

if('detail.accountId' == "1234567890", "AccountX", "UnknownAccountName")
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

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

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...