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!

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

 Prepare to elevate your security operations with the powerful upgrade to Splunk Enterprise Security 8.x! This ...

Get Early Access to AI Playbook Authoring: Apply for the Alpha Private Preview ...

Passionate about security automation? Apply now to our AI Playbook Authoring Alpha private preview ...

Reduce and Transform Your Firewall Data with Splunk Data Management

Managing high-volume firewall data has always been a challenge. Noisy events and verbose traffic logs often ...