Splunk Search

How to automatically remove extraneous characters from field value?

hcannon
Path Finder

Splunk is automatically (and correctly) extracting a user field/value in a particular set of logs, I'm looking for a way to setup an automatic field extraction (field transformation?) that will pull extraneous characters from the field value when they exist. I am trying to pull this data into the CIM for authentication, so need the data extracted automatically without the domain info.

Example - the following values are automatically being extracted as the field "user":
systemqa

systemprod
user-sync
userserviceacct
domain.local\jdoe
domain.local\bsmith
domain.local\mgarcia
domain.local\hjohnson

I need Splunk to automatically remove the string "domain.local\" from the user field in this log source- I know a few ways to do this within a search, but I'm lost as to how to do this automatically.

0 Karma
1 Solution

niketn
Legend

@hcannon, you are possibly looking for Calculated Fields Knowledge Object where eval commands can be saved. You can also achieve something similar if you use macro to place your custom logic for formatting data.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

0 Karma

woodcock
Esteemed Legend

Take the RegEx that you are using in search to change this at search time and go to Settings -> Fields -> Field transformations -> New and create an automatic extraction with it.

0 Karma

niketn
Legend

@hcannon, you are possibly looking for Calculated Fields Knowledge Object where eval commands can be saved. You can also achieve something similar if you use macro to place your custom logic for formatting data.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

hcannon
Path Finder

Yes, calculated fields were exactly what I was looking for - I hadn't used those before, so didn't realize that concept existed. I stuck the eval I was using as a find/replace in a new calculated field knowledge object and this did the trick. thanks!

0 Karma

niketn
Legend

@hcannon, I have converted my comment to answer. Please accept to mark this as answered 🙂

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...