All Apps and Add-ons

Does the Twilio app work with the python installed with splunk?

jcbfaulks
Explorer

I installed the twilio app and configured it per its documentation, but it is throwing an error saying that it can not import the module twilio.rest when trying to run the python scripts to pull down data. As far as I can tell there is no clear way to add a python module to splunk. Do you have to configure it to use an external python installation, or am I missing something here?

0 Karma
1 Solution

emiller42
Motivator

It doesn't appear that this app would ever work out of the box, as it attempts to use the Twilio Python Module, which isn't included in the app, and not mentioned in the instructions.

You can attempt to install the Twilio Python Module from the link above, but because Splunk uses it's own Python executable, I'm not sure how well that will work. I tried dropping it into the bin/ directory of the app and while it resolved your error, It just hit another include it didn't know what to do with:

[Eric@Erics-MacBook-Air bin]$ splunk cmd python get_call_logs.py 
Traceback (most recent call last):
  File "get_call_logs.py", line 6, in <module>
    from twilio.rest import TwilioRestClient
  File "/Applications/Splunk/etc/apps/twilio-app/bin/twilio/__init__.py", line 4, in <module>
    from six import u
ImportError: No module named six

You can go pull that module down and include it in the apps bin/ directory too, but that's getting a little ridiculous, and doesn't get the app working anyway. (After doing so, I got CertificateHostnameMismatch errors that can't be easily fixed)

Bottom line: Recommend contacting the developer of the app asking for a proper fix. The app as distributed seems unusable.

View solution in original post

himynamesdave
Contributor

Hey Jacob - sorry about this. Eric is right (thanks for the attempted fix!). I hacked my Splunk to get this to work originally and didn't really think when shipping the app in haste.

I'm actually working on updating this app to include calls to the Twilio API, bypassing the need for Python scripts completely. Should be complete in a few weeks.

In the meantime, I've shipped a new version with updated docs to include a loose workaround that will work in some environments.

dvavasour
Engager

Any guidance on OS/Python versions? I tried to get this working on CentOS 6.5 with Python 2.6.6, and both the scripts were throwing errors. My Python's not really good enough to debug this.

0 Karma

jyuan_splunk
Splunk Employee
Splunk Employee
0 Karma

emiller42
Motivator

None of that really applies when dealing with a Splunk app. Splunk bundles it's own Python interpreter, so it's not using the system Python, which all of those tips assume. One would expect any Splunk apps utilizing python to be entirely self-contained and run as expected out of the box without any additional Python environment configuration.

emiller42
Motivator

It doesn't appear that this app would ever work out of the box, as it attempts to use the Twilio Python Module, which isn't included in the app, and not mentioned in the instructions.

You can attempt to install the Twilio Python Module from the link above, but because Splunk uses it's own Python executable, I'm not sure how well that will work. I tried dropping it into the bin/ directory of the app and while it resolved your error, It just hit another include it didn't know what to do with:

[Eric@Erics-MacBook-Air bin]$ splunk cmd python get_call_logs.py 
Traceback (most recent call last):
  File "get_call_logs.py", line 6, in <module>
    from twilio.rest import TwilioRestClient
  File "/Applications/Splunk/etc/apps/twilio-app/bin/twilio/__init__.py", line 4, in <module>
    from six import u
ImportError: No module named six

You can go pull that module down and include it in the apps bin/ directory too, but that's getting a little ridiculous, and doesn't get the app working anyway. (After doing so, I got CertificateHostnameMismatch errors that can't be easily fixed)

Bottom line: Recommend contacting the developer of the app asking for a proper fix. The app as distributed seems unusable.

jcbfaulks
Explorer

Thanks for the answer. I actually got the CertificateHostnameMismatch error fixed by including httplib2 v0.8 in the bin directory of the app. That gets the scripts to actually run from command line, but still having some problems with it running correctly. In the end I decided to just scrap using the app and make my own.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...