Splunk® Machine Learning Toolkit

ML-SPL API Guide

Download manual as PDF

Download topic as PDF

Custom logging

For more detailed logging, you can also use a logger with a custom name as in the following example:

from cexc import get_logger


logger = get_logger('MyCustomLogging')
logger.warn('warning!')
logger.error('error!')
logger.debug('info!')

These messages will be logged to $SPLUNK_HOME/var/log/mlspl.log.

Alongside the name provided in get_logger, the function we're inside of (in this case the __init__ method) is also recorded:

1491862833.627798 2017-04-10 15:20:33,627 WARNING [mlspl.MyCustomLogging] [__init__] warning!
1491862833.627949 2017-04-10 15:20:33,627 ERROR [mlspl.MyCustomLogging] [__init__] error!
1491862833.628024 2017-04-10 15:20:33,628 DEBUG [mlspl.MyCustomLogging] [__init__] info!

When all else fails, the best place to look is search.log. If you are still stuck, try posting your question on Splunk Answers.

PREVIOUS
User facing messages
  NEXT
Custom algorithms using PSC libraries

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?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

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