Splunk Search

How to extract fields with differing lengths from cs-uri-stem entries?

patelpin
New Member

Hello,

I am trying to pull certain criteria out of cs-uri-stem that contain different lengths for cs-uri-stem. I am trying to get one field extraction from all the examples.

Here are some examples of the cs_uri_stem entries:

/apps/orderalert/default.aspx
/netpub/ser.np
/apps/ajt/a2dsfile/files/dll/data.dll
/apps/ajt/SE3SPXWEBSERVICE/SpxSE3WebService.asmx
/aspnet_client/system_web/2_0_50727/Themes/Normal/images/sss_head_bg.gif

The goal is to get everything minus the last bit and the "/" at the beginning and end. I have highlighted what it is I want to get out of cs_uri_stem. If I need to post more from the log files I can.

apps/orderalert
netpub
apps/ajt/a2dsfile/files
apps/ajt/SE3SPXWEBSERVICE
aspnet_client/system_web/2_0_50727/Themes/Normal/images

0 Karma
1 Solution

sundareshr
Legend

Try this

base search | rex field=cs_uri_stem "\/(?<fld>.*)\/"

View solution in original post

sundareshr
Legend

Try this

base search | rex field=cs_uri_stem "\/(?<fld>.*)\/"

patelpin
New Member

This worked great, thanks. I was able to use "\/(?.*)\/ in cs_uri_stem" to make it work for me.

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...