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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...