Splunk Search

Using rex to filter fields

leandromatperei
Path Finder

Hello everyone,

I have the following pattern of logs and I'm trying to use rex to filter the values.

I started doing it like this:  | rex field=_raw "attr_itx_media_type\s(?<midias>.*)"

I need to get everything between ""

Ex. voicePerdida, smscustom, email

 

 

attr_itx_media_type [str] = "voicePerdida"
attr_itx_media_type [str] = "smsCustom"
attr_itx_media_type [str] = "email"

 

 

 

Labels (1)
Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @leandromatperei,

if yur logs are like the examples you shared the regex isn't correct, could you share a full sample of your logs?

Anyway, if you logs contains the string you shared, try the following regex:

| rex "attr_itx_media_type\s+\[str\]\s+\=\s+\"(?<attr_itx_media_type>[^\"]+)\""

that you can test at https://regex101.com/r/6TioIW/1

Ciao.

Giuseppe

 

0 Karma
Get Updates on the Splunk Community!

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...

Splunk AppDynamics Agents Webinar Series

Mark your calendars! On June 24th at 12PM PST, we’re going live with the second session of our Splunk ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2025 SplunkTrust is officially open! If you ...