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!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...