本文整理匯總了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)