Splunk® Machine Learning Toolkit

ML-SPL API Guide

Acrobat logo Download manual as PDF


This documentation does not apply to the most recent version of Splunk® Machine Learning Toolkit. For documentation on the most recent version, go to the latest release.
Acrobat logo Download topic as PDF

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:

Userfacingmessage.png

You can similarly produce error messages:

some_variable = 'hello there'
messages.error('Message of your choosing: {}'.format(some_variable))

Userfacingmsg2.png

Last modified on 03 July, 2019
PREVIOUS
Savitzky-Golay Filter
  NEXT
Custom logging

This documentation applies to the following versions of Splunk® Machine Learning Toolkit: 2.3.0, 2.4.0, 3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.4.0, 4.0.0, 4.1.0, 4.2.0, 4.3.0


Was this documentation topic helpful?


You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters