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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...