Splunk Search

Remove host name in Account_Name field

Becherer
Explorer

When people RDP into a server, the results I am getting into splunk is Account_Name=Sever1$ Account_Name = jdoe.

When I try to display the data in a table it displays...
Account_Name:
Server1$
jdoe

I want to remove the "Server1$" from field.

One thing I will add, is this only happens sometime and not all of the time. Can there be a wildcard to remove anything before the "$".

Labels (3)
Tags (1)
0 Karma
1 Solution

bmunson_splunk
Splunk Employee
Splunk Employee

There are two ways to fix this. You could change the way the fields are extracted or you can filter them out at search time.
As these are representing machine accounts that may need to be traced at a later date, I would prefer not to stop splunk extracting them.
My preferred way of doing this is with an eval function in search.

   | eval Account_Name=mvfilter(match(Account_Name, ".+[^$]$") )

This is using mvfilter to remove fields that don't match a regex. The regex is looking for .* meaning anything followed by [^$]meaning anything that is not a $ symbol then $ as an anchor meaning that must be the end of the field value.

View solution in original post

bmunson_splunk
Splunk Employee
Splunk Employee

There are two ways to fix this. You could change the way the fields are extracted or you can filter them out at search time.
As these are representing machine accounts that may need to be traced at a later date, I would prefer not to stop splunk extracting them.
My preferred way of doing this is with an eval function in search.

   | eval Account_Name=mvfilter(match(Account_Name, ".+[^$]$") )

This is using mvfilter to remove fields that don't match a regex. The regex is looking for .* meaning anything followed by [^$]meaning anything that is not a $ symbol then $ as an anchor meaning that must be the end of the field value.

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 ...