Splunk Search

Help writting and fixing a rex query

phamxuantung
Communicator

Hello,

I have a raw data that go like this

 

...
in[ 60: ]<3034>
in[ 62: ]<10>
in[ 62: ]<EC_CARDVER>
...

 

 

I want to extract the EC_CARDVER to a field name msg

My rex is

 

| rex field=_raw "(in)\[ 62: \]\<(?P<msg>)\>"

 

But it doesn't seem to catch on. How do I write to extract only the EC_CARDVER but not the 10 above it?

Labels (2)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

Assuming the difference is the first character must not be numerical, try

| rex "in\[ *\d+: *]<(?<msg>\D[^>]+)"

(You don't need to specify field when using _raw.)

View solution in original post

yuanliu
SplunkTrust
SplunkTrust

Assuming the difference is the first character must not be numerical, try

| rex "in\[ *\d+: *]<(?<msg>\D[^>]+)"

(You don't need to specify field when using _raw.)

phamxuantung
Communicator

Your query extract a different fields than what I want, because there're many rows that have 'in [ ]' before, so I tweak it a bit

| rex "in\[ *62+: *]<(?<msg>\D[^>]+)"

Then it work just the way I want it to. Thank you

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...