本文整理汇总了Python中splunk.models.saved_search.SavedSearch.build_id方法的典型用法代码示例。如果您正苦于以下问题:Python SavedSearch.build_id方法的具体用法?Python SavedSearch.build_id怎么用?Python SavedSearch.build_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类splunk.models.saved_search.SavedSearch
的用法示例。
在下文中一共展示了SavedSearch.build_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_headlines_detail
# 需要导入模块: from splunk.models.saved_search import SavedSearch [as 别名]
# 或者: from splunk.models.saved_search.SavedSearch import build_id [as 别名]
def get_headlines_detail(self, headlines, app, user, count, earliest, severity=None, srtd=None):
search_string = ""
sorted_list = []
if earliest is not None:
search_string = search_string + ' trigger_time > ' + str(self.get_time(earliest))
for headline in headlines:
try:
s = SavedSearch.get(SavedSearch.build_id(headline.alert_name, app, user))
alerts = None
if s.alert.severity in severity:
alerts = s.get_alerts()
if alerts is not None:
if len(search_string) > 0:
alerts.search(search_string)
for alert in alerts:
h = {'message' : self.replace_tokens(headline.message, alert.sid),
'job_id' : alert.sid,
'severity' : s.alert.severity,
'count' : alert.triggered_alerts,
'time' : alert.trigger_time.strftime('%s'),
'timesince' : timesince(alert.trigger_time)}
sorted_list.append(h)
except Exception, ex:
logger.warn('problem retreiving alerts for saved search %s' % headline.alert_name)
logger.debug(ex)