User facing messages
Because the Splunk Machine Learning Toolkit relies on a different python interpreter than the one shipped with Splunk Enterprise, there are a few things you might do differently to debug your code. The Splunk Machine Learning Toolkit comes with some utilities to make logging and user-facing errors easier to manage.
First, import and create a messages logger as follows:
from cexc import get_messages_logger messages = get_messages_logger()
After that, you can add user facing messages quite easily as shown below:
some_variable = 'hello there' messages.warn('Message of your choosing: {}'.format(some_variable))
This produces the search warning in the following example:
You can similarly produce error messages:
some_variable = 'hello there' messages.error('Message of your choosing: {}'.format(some_variable))
Savitzky-Golay Filter | Custom logging |
This documentation applies to the following versions of Splunk® Machine Learning Toolkit: 2.2.0, 2.2.1
Feedback submitted, thanks!