本文整理汇总了Python中splunk.Intersplunk.parseError方法的典型用法代码示例。如果您正苦于以下问题:Python Intersplunk.parseError方法的具体用法?Python Intersplunk.parseError怎么用?Python Intersplunk.parseError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类splunk.Intersplunk
的用法示例。
在下文中一共展示了Intersplunk.parseError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _handle_response
# 需要导入模块: from splunk import Intersplunk [as 别名]
# 或者: from splunk.Intersplunk import parseError [as 别名]
def _handle_response(self, response, content):
if response.status in (200, 201):
resp = self._get_resp_record(content)
if resp:
result = self._get_result(resp)
else:
result = {"error": "Failed to create ticket"}
self.logger.debug(result)
return result
else:
self.logger.error("Failed to create ticket. Return code is %s. "
"Reason is %s", response.status, response.reason)
si.parseError("Failed to create ticket. Return code is {0}. Reason"
" is {1}".format(response.status, response.reason))
return None
示例2: parseArgs
# 需要导入模块: from splunk import Intersplunk [as 别名]
# 或者: from splunk.Intersplunk import parseError [as 别名]
def parseArgs(txt):
m = re.match('\s*(?:(?P<count>-?\d+)\s+)?(?P<variables>.+)', txt)
if m == None:
si.parseError(usage())
md = m.groupdict()
counttext = md['count']
count = 1
if counttext != None:
count = int(counttext)
variables = md['variables']
mapping = []
matches = re.findall("(?i)\s*(?:(?P<alias>[a-z0-9_.]+)\s*[=])?\s*(?P<field>[$a-z0-9_.]+)", variables)
for alias, value in matches:
if value.startswith('$'):
value = value[1:]
elif alias == '':
alias = value
mapping.append((alias, value))
return count, mapping
示例3: error
# 需要导入模块: from splunk import Intersplunk [as 别名]
# 或者: from splunk.Intersplunk import parseError [as 别名]
def error(self, message):
si.parseError("{0}. {1}".format(message, self.format_usage()))
示例4: _handle_error
# 需要导入模块: from splunk import Intersplunk [as 别名]
# 或者: from splunk.Intersplunk import parseError [as 别名]
def _handle_error(self, msg):
si.parseError(msg)
示例5: len
# 需要导入模块: from splunk import Intersplunk [as 别名]
# 或者: from splunk.Intersplunk import parseError [as 别名]
import csv
import sys
import splunk.Intersplunk as intersplunk
import splunk.rest as rest
import urllib
import json
import re
import collections
#(isgetinfo, sys.argv) = intersplunk.isGetInfo(sys.argv)
if len(sys.argv) < 2:
intersplunk.parseError("Please specify a valid incident_id")
#if isgetinfo:
# intersplunk.outputInfo(False, False, True, False, None, True)
# # outputInfo automatically calls sys.exit()
stdinArgs = sys.stdin.readline()
stdinArgs = stdinArgs.strip()
stdinArgs = stdinArgs[11:]
stdinArgs = urllib.unquote(stdinArgs).decode('utf8')
match = re.search(r'<authToken>([^<]+)</authToken>', stdinArgs)
sessionKey = match.group(1)
incident_id = sys.argv[1]
query = {}
query['incident_id'] = incident_id
uri = '/servicesNS/nobody/alert_manager/storage/collections/data/incident_results?query=%s' % urllib.quote(json.dumps(query))
serverResponse, serverContent = rest.simpleRequest(uri, sessionKey=sessionKey)
示例6: len
# 需要导入模块: from splunk import Intersplunk [as 别名]
# 或者: from splunk.Intersplunk import parseError [as 别名]
import csv
import sys
import splunk.Intersplunk as intersplunk
import splunk.rest as rest
import urllib
import json
import re
import collections
#(isgetinfo, sys.argv) = intersplunk.isGetInfo(sys.argv)
if len(sys.argv) < 2:
intersplunk.parseError("Please specify a valid risk_id")
#if isgetinfo:
# intersplunk.outputInfo(False, False, True, False, None, True)
# # outputInfo automatically calls sys.exit()
stdinArgs = sys.stdin.readline()
stdinArgs = stdinArgs.strip()
stdinArgs = stdinArgs[11:]
stdinArgs = urllib.unquote(stdinArgs).decode('utf8')
match = re.search(r'<authToken>([^<]+)</authToken>', stdinArgs)
sessionKey = match.group(1)
risk_id = sys.argv[1]
query = {}
query['risk_id'] = risk_id
uri = '/servicesNS/nobody/risk_manager/storage/collections/data/risk_results?query=%s' % urllib.quote(json.dumps(query))
serverResponse, serverContent = rest.simpleRequest(uri, sessionKey=sessionKey)