Splunk Search

REX question.

fotc1969
New Member

Hello, I'm having a really hard time pulling the status code from an HA proxy log using a rex command. there are a number of reasons i cant use field extraction that i don't want to go into, but just know that i cant. Im only trying to figure out how to create regex that can match the following examples:

0/0/0/179/179 200 611 - -
0/0/0/11/66 200 103092 - -
0/0/0/9/9 200 44487 - -

Notice that everything around the status code varies, but the pattern remains the same.

here's my best attempt:

| rex field=logMessage "^(?:[^/\n]*/){7}\d+\s+(?P\d+)"

but it's missing several examples. how can i make it better?

Tags (2)
0 Karma
1 Solution

PowerPacked
Builder

Use this Rex to extract

alt text

This splunk answers page will replace the fieldname in between REX, so adding up the image

Thanks

View solution in original post

0 Karma

PowerPacked
Builder

Use this Rex to extract

alt text

This splunk answers page will replace the fieldname in between REX, so adding up the image

Thanks

0 Karma
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...