All Apps and Add-ons

Response Filter for REST API Modular Input not filtering

efullman
Path Finder

I'm using one of the public Twitter streaming APIs. I was hoping I could cause it to only index events that match a Regex in the Response Filter (as advertised), but it seems to ignore it. I tested the Regex, but I'm missing some detailed documentation that might answer my questions.

Has anyone gotten this to work? I was just searching for this - lang":"en"

I'm assuming this would reject all events that don't include this, so as a result, only English tweets would flow through to the index. Unfortunately, everything still flows through.

0 Karma

Damien_Dallimor
Ultra Champion

What is the Python Regex pattern that you are entering in your setup for the response filter parameter ? Perhaps this pattern is wrong.

0 Karma

efullman
Path Finder

Damien,

Thanks for the response. I think I understand the purpose of this function now.

It doesn't filter the events that are indexed, it filters what is indexed in each event?

So you need capture groups (...) in the REGEX, and the captures get indexed?

Or is there a way to disregard a whole event? Such as nesting the captures (...(...)...) where one of the inner captures matches to a literal like "lang:"en and when the REST API modular input can't find the literal it ejects the whole event.?

Thanks for your thoughts.

0 Karma

Damien_Dallimor
Ultra Champion

I think you are confusing yourself.

It is rather simple.

Write a REGEX. If the REGEX matches the raw response, it gets processed and sent to Splunk for indexing. Else , it gets discarded.

0 Karma

efullman
Path Finder

Just searching for the literal - lang":"en"to start. It should match at least 40% of the time.

0 Karma

Damien_Dallimor
Ultra Champion

Thats doesn't look like a Python Regex Pattern that would match an entire response.

I would suggest getting some data of an entire raw response and trying out some Regexes first.
There are some online tools for trying out Regexes such as http://pythex.org/

0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...