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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...