Splunk Search

How to use eval or other method in calculated fields to extract values into a new field?

reach2tushar
Explorer

Hi,

I am thinking of using the Calculated Fields option to extract one field.
I have following values in a field name "YOURFIELD"
Test_X
TestA_Y
TestBC_Z_all
I want to extract the characters before "_" in a new field "MYFIELD". The result will be:
Test
TestA
TestBC

Can please help me to extract this result in calculated fields using an EVAL function or any other method?

Tags (4)
0 Karma

Ayn
Legend
... | rex field=YOURFIELD "(?<MYFIELD>.+?)_"

Ayn
Legend

Yes, you can.

0 Karma

reach2tushar
Explorer

Thanks for the reply Ayn. Can we use RegEx in Calculated fields?

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In January, the Splunk Threat Research Team had one release of new security content via the Splunk ES Content ...

Expert Tips from Splunk Professional Services, Ensuring Compliance, and More New ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Observability Release Update: AI Assistant, AppD + Observability Cloud Integrations & ...

This month’s releases across the Splunk Observability portfolio deliver earlier detection and faster ...