Splunk Search

Return string and number before and after equals sign

soumyajk
Engager

Hi,

I am new in splunk and i want to save the value in fields before and after =

for example events look like below
rollnumber=34556
class=12

I want to return rollnumber and class in first field and the number after = in second field.

base search | rex max_match=15 field=_raw "(?P)="

this doesnt work, both values are coming as space.

0 Karma
1 Solution

damien_chillet
Builder

Your regex seems to be incomplete, could you try:

| rex max_match=15 field=_raw "(?P<field1>\w+)\=(?P<field2>\w+)" 

View solution in original post

damien_chillet
Builder

Your regex seems to be incomplete, could you try:

| rex max_match=15 field=_raw "(?P<field1>\w+)\=(?P<field2>\w+)" 
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...