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!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...