Splunk Dev

Regular expression in restmap.conf

tmontney
Builder

So I'd like to have one custom rest handler that allows for URLs like

  • /myapp/files
  • /myapp/files/0

restmap.conf

[script:myapp_files]
match=/myapp/files*
python.version=python3
handler=myapp_files.req
methods=GET,POST,PUT,DELETE
script = myapp_files.py
scripttype = persist
 
web.conf
 
[expose:myapp_files]
pattern=myapp/files*
methods=GET,POST,PUT,DELETE
 
https://docs.splunk.com/Documentation/Splunk/8.1.0/Admin/Restmapconf#restmap.conf.example doesn't appear to say anything about "match" being a regular expression.
Labels (2)
Tags (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

I would presume that if the docs don't say a regex is allowed then a regex is not allowed.

There are examples, however, of pattern use in the OOTB restmap.conf files.  See splunk_instrumentation/default/restmap.conf for an example.  In your case adding a slash may help.

match=/myapp/files/*

If it works then submit feedback on that documentation page to ask them to say patterns are allowed.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

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, ...