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!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...