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!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...