Getting Data In

Field Calculation not working

mr_t2083
Explorer

What I'm trying to do is create a field named ids_type and make it equal to network. (ids_type=network)

I'm trying to add a new field to a sourcetype. The name of the field is ids_type. I created an eval statement that works when i run a search. But when I save it as a calculated field it doesn't seem to work. The eval expression is if(rec_type="400","network",null). I have refreshed Splunk, restarted Splunk and changed the permissions of the field calculation to all apps. But it doesn't seem to be working. what else can I troubleshoot?

0 Karma

sebastianszykie
Explorer

If anyone is having the same problem with the TA-eStreamer add on, the field is supposed to be defined using a built-in lookup to sources.csv. In the lookup file the source is defined as estreamer whereas the encore app is now has a source of encore. To fix the problem updated the sources.csv lookup file and add another line :

source,vendor,product,ids_type
eStreamer,Cisco,Sourcefire,network
encore,Cisco,Firepower,network

echalex
Builder

Is rec_type numeric? Because, you're comparing it to the string "400". Remove the quotes and you should be fine. To be extra sure, you could use tonumber() to convert.

if(rec_type=400, "network", null)
OR if that doesn't work:
if(tonumber(rec_type)=400 , "network", null)

nickhills
Ultra Champion

ha! I was about to suggest that too, but i refreshed the page and you beat me to it!

Its also worth checking that your sourcetype is set correctly, the result of the calculated field should look like this is props.conf

[your_sourcetype_name]
EVAL-ids_type = if(rec_type=400, "network", null)
If my comment helps, please give it a thumbs up!
0 Karma

Yunagi
Communicator

I'm not sure if it makes a difference, but try to replace null with null().

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Does the rec_type field exist? What are the permissions for it?

---
If this reply helps you, Karma would be appreciated.
0 Karma

mr_t2083
Explorer

Yes the rec_type field does exist it. I have tried several eval statement such as eval ids_type="network" and that still didn't work. Not sure what I'm doing wrong.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...