Splunk Dev

Python end point configured in web.conf is not working

paramagurukarth
Builder

I am just trying to make a python method to respond for a http request (Interact with python using javascript).
I got an url from splunk wiki
The configuration given in that url is
1. Create an app with my python module inside controllers folder
2. In web.conf create a endpoint as [endpoint:]
3. just restart. The method inside the puython module can be accessed through the url
./custom///
4. Restart and login again

But, even after doing the above configuration URL of the above pattern is not available.
Anyone Please share your knoledge related to this.

Thanks.

1 Solution

paramagurukarth
Builder

Sorry.. Same set up works for me...
Previously I just configured the web.conf in $Splunk_Home$/etc/system/local..
Now I did the same configuration inside $Splunk_Home$/etc/apps//default. It works and my python function is working as a listener for a http request (http:/ip:/custom///)

web.conf :
[endpoint:netutils] #Name of the python file

netutils.py
import cherrypy
import splunk.appserver.mrsparkle.controllers as controllers
from splunk.appserver.mrsparkle.lib.decorators import expose_page
from splunk.appserver.mrsparkle.lib.routes import route

class MyControllerController(controllers.BaseController):
@expose_page(must_login=True)
def listenerGet(self, **kwargs):
cherrypy.response.headers['Content-Type'] = 'text/plain'
return 'I am responding for your request'

Please refer http://wiki.splunk.com/Community:40GUIDevelopment

View solution in original post

paramagurukarth
Builder

Sorry.. Same set up works for me...
Previously I just configured the web.conf in $Splunk_Home$/etc/system/local..
Now I did the same configuration inside $Splunk_Home$/etc/apps//default. It works and my python function is working as a listener for a http request (http:/ip:/custom///)

web.conf :
[endpoint:netutils] #Name of the python file

netutils.py
import cherrypy
import splunk.appserver.mrsparkle.controllers as controllers
from splunk.appserver.mrsparkle.lib.decorators import expose_page
from splunk.appserver.mrsparkle.lib.routes import route

class MyControllerController(controllers.BaseController):
@expose_page(must_login=True)
def listenerGet(self, **kwargs):
cherrypy.response.headers['Content-Type'] = 'text/plain'
return 'I am responding for your request'

Please refer http://wiki.splunk.com/Community:40GUIDevelopment

amritanshgupta
Explorer

I can't get this to work. Is it not supported in 6.4.x and above?
The documentation you've linked to in another answer is of Splunk 4.x
I always get a error 404, even when I tried to run your exact code. Anyway I can fix this?

Thanks

0 Karma

kasu_praveen
Communicator

Hi paramagurukarthikeyan, Thanks for posting this. I am also looking similar one like this.
couple of clarifications.

1, How you called "MyPython.py" in your HTML view page?
2. You mentioned endpoint as "netutils", But where are you using this?, I am not seeing this in .py file.

Thanks for your time.

0 Karma

paramagurukarth
Builder
0 Karma

kasu_praveen
Communicator

Got answers for my above questions in another thread link text. Thanks

0 Karma

paramagurukarth
Builder

Sorry, I couldn't help you.. I just saw 🙂

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...