Splunk® Machine Learning Toolkit


Acrobat logo Download manual as PDF

Acrobat logo Download topic as PDF

Create user facing messages

The Splunk Machine Learning Toolkit ships with utilities to make logging and user-facing errors easier to manage.

The Splunk Machine Learning Toolkit relies on a different Python interpreter than the interpreter shipped with Splunk Enterprise.

To begin, import and create a messages logger as follows:

from cexc import get_messages_logger
messages = get_messages_logger()

Once completed, you can add user facing messages as shown in the following code blocks:

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

This code 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))

This code produces the error message in the following example:


Last modified on 01 August, 2019
Develop and package a custom machine learning model in MLTK
Use custom logging

This documentation applies to the following versions of Splunk® Machine Learning Toolkit: 4.4.0, 4.4.1, 4.4.2, 4.5.0, 5.0.0, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 5.3.0, 5.3.1, 5.3.3, 5.4.0, 5.4.1

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