Splunk Search

Is there anyway to modify a field name automatically at search time configuring props.conf and transforms.conf?

ryoji_solsys
Explorer

Is there anyway I can modify a field name at search time ?

I have a field "client__phone" (with double underscores) which is dynamically generated based on my regex in transforms.conf as shown below at search time.

[req_transform]
CLEAN_KEYS = 1
REGEX = request\=\"(?<_KEY_1>\w+.+\w+)\:(?<_VAL_1>\w+|\d+)\}\s
MV_ADD = 1

And a sample data is

...request="client:{phone:1234456} receiver:{23404} accesspoint:{Notifier} endpoint:{343} " opn=".....

I would like to append "req" in front of the field and remove an underscore so that it becomes something like "req_client_phone".

I would like to modify the field automatically by editing transforms.conf and props.conf. I know that I can modify the field with "rename"
command but I want to do this "automatically".

Thanks.

1 Solution

richgalloway
SplunkTrust
SplunkTrust

Have you considered creating an alias? Put this in your props.conf file:

FIELDALIAS-clientPhone = phone AS req_client_phone
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Have you considered creating an alias? Put this in your props.conf file:

FIELDALIAS-clientPhone = phone AS req_client_phone
---
If this reply helps you, Karma would be appreciated.

somesoni2
Revered Legend

Generic field alias would be like this

FIELDALIAS-clientfields = client__* as req_client_*
0 Karma

ryoji_solsys
Explorer

Hi richgalloway and somesoni2,

Thanks for the quick reply.
"FIELDALIAS" works for me.
I tried using wildcard as somesoni2 suggested but it's not working for me.
I wonder if "FIELDALIAS" doesn't support wildcard.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...