Splunk® Machine Learning Toolkit

ML-SPL API Guide

Create user facing messages

The Splunk Machine Learning Toolkit (MLTK) ships with utilities to make user-facing errors easy to manage.

MLTK relies on a different Python interpreter than the interpreter that ships with Splunk Enterprise.

Complete the following steps:

  1. Import and create a messages logger:
    from cexc import get_messages_logger
    messages = get_messages_logger()
    
  2. Add user facing messages:
    1. Use the following syntax to add a warning message:
      some_variable = 'hello there'
      messages.warn('Message of your choosing: {}'.format(some_variable))
      
      Userfacingmessage.png
    2. Use the following syntax to add an error messages:
      some_variable = 'hello there'
      messages.error('Message of your choosing: {}'.format(some_variable))
      
      Userfacingmsg2.png
Last modified on 31 January, 2024
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: 5.2.0, 5.2.1, 5.2.2, 5.3.0, 5.3.1, 5.3.3, 5.4.0, 5.4.1, 5.4.2, 5.5.0


Was this topic useful?







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