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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...