Splunk Search

How to create a field from another field?

lys1030
Explorer

I have a field "F1" with values as following:
alt text
I want to add a filed "F2" with value 'a' to all 'a*', with value 'b' to all 'b*'.
alt text
What should I do?
Thanks in advance!

Tags (1)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi lys1030,

try this little regex:

your base search here | rex field=F1 "(?<F2>[a-zA-Z])" | table F1 F2

Hope this helps ...

cheers, MuS

View solution in original post

woodcock
Esteemed Legend

Like this:

| eval F1 = substr(F2,1,1)

MuS
SplunkTrust
SplunkTrust

Hi lys1030,

try this little regex:

your base search here | rex field=F1 "(?<F2>[a-zA-Z])" | table F1 F2

Hope this helps ...

cheers, MuS

Get Updates on the Splunk Community!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...