Splunk Dev

On Linux how to allow non-root users to use the splunklib Python module

sillingworth
Path Finder

After installing splunksdk on a linux server only the root user could import splunklib, other users would get

"ImportError: No module named splunklib.client" *(or .results, etc)*

The module had installed itself in:

/lib/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info

I've got it working now and will post an answer so people searching for the same issue can find it, but I'm not really happy with it - seems like a fudge. I'd like to know what people think: is this intended behaviour? Is there a better fix? Is this a mistake by Splunk, or by the people who wrote the distro or configured my server (it's running Oracle Linux Server 7), or potentially a mistake I made installing the module (if I recall correctly it was just a case of, as root, extracting the archive then running python setup.py install)?

Tags (1)
0 Karma

sillingworth
Path Finder

My solution, which works but seems less than ideal, was:

in /lib/python2.7/site-packages/:

chmod -R 755 setuptools-0.9.8-py2.7.egg-info
ln -s setuptools-0.9.8-py2.7.egg-info/splunklib splunklib
0 Karma

sillingworth
Path Finder

The fact I had to do the chmod I think points to a server config issue, probably the umask, but the second issue seems very strange. So root was looking inside setuptools-0.9.8-py2.7.egg-info whereas other users weren't. I have no idea why this would be.

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...