How to use the solnlib.log.Logs function in solnlib

To help you get started, we’ve selected a few solnlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PaloAltoNetworks / pandevice / install / Splunk_TA_paloalto / bin / splunk_ta_paloalto_setup.py View on Github external
corresponds to handleractions = edit in restmap.conf
"""
import splunk_ta_paloalto_declare

import json
import splunk.clilib.cli_common as scc
import splunk.admin as admin


import solnlib.utils as utils
import solnlib.log as log
import solnlib.conf_manager as conf
import splunk_ta_paloalto_consts as setup_const

log.Logs.set_context(namespace="splunk_ta_paloalto")
logger = log.Logs().get_logger("setup")

def get_or_create_conf_file(conf_mgr, file_name):
    try:
        conf_file = conf_mgr.get_conf(file_name)
        return conf_file
    except conf.ConfManagerException as cme:
        conf_mgr._confs.create(file_name)
        return conf_mgr.get_conf(file_name, refresh=True)

def filter_eai_property(stanza):
    if isinstance(stanza, dict):
        for k in list(stanza.keys()):
            if k.startswith('eai:'):
                del stanza[k]
            else:
                stanza[k] = filter_eai_property(stanza[k])
github PaloAltoNetworks / Splunk_TA_paloalto / bin / splunk_ta_paloalto_setup.py View on Github external
corresponds to handleractions = edit in restmap.conf
"""
import splunk_ta_paloalto_declare

import json
import splunk.clilib.cli_common as scc
import splunk.admin as admin


import solnlib.utils as utils
import solnlib.log as log
import solnlib.conf_manager as conf
import splunk_ta_paloalto_consts as setup_const

log.Logs.set_context(namespace="splunk_ta_paloalto")
logger = log.Logs().get_logger("setup")

def get_or_create_conf_file(conf_mgr, file_name):
    try:
        conf_file = conf_mgr.get_conf(file_name)
        return conf_file
    except conf.ConfManagerException as cme:
        conf_mgr._confs.create(file_name)
        return conf_mgr.get_conf(file_name, refresh=True)

def filter_eai_property(stanza):
    if isinstance(stanza, dict):
        for k in list(stanza.keys()):
            if k.startswith('eai:'):
                del stanza[k]
            else:
                stanza[k] = filter_eai_property(stanza[k])