Esempio n. 1
0
    def __init__(self, *args):
        super(SpikeRule, self).__init__(*args)
        self.timeframe = self.rules['timeframe']

        self.ref_windows = {}
        self.cur_windows = {}

        self.ts_field = self.rules.get('timestamp_field', '@timestamp')
        self.get_ts = new_get_event_ts(self.ts_field)
        self.first_event = {}
        self.skip_checks = {}

        self.ref_window_filled_once = False
Esempio n. 2
0
    def __init__(self, *args):
        super(SpikeRule, self).__init__(*args)
        self.timeframe = self.rules['timeframe']

        self.ref_windows = {}
        self.cur_windows = {}

        self.ts_field = self.rules.get('timestamp_field', '@timestamp')
        self.get_ts = new_get_event_ts(self.ts_field)
        self.first_event = {}
        self.skip_checks = {}

        self.ref_window_filled_once = False
Esempio n. 3
0
    def __init__(self, *args):
        super(SpikeAggregationRule, self).__init__(*args)

        # shared setup
        self.ts_field = self.rules.get('timestamp_field', '@timestamp')
        elastalert_logger.info("===============================self.ts_field: %s", self.ts_field)

        # aggregation setup
        # if 'max_threshold' not in self.rules and 'min_threshold' not in self.rules:
        #     raise EAException("MetricAggregationRule must have at least one of either max_threshold or min_threshold")


        self.metric_key = self.rules['metric_agg_key'] + '_' + self.rules['metric_agg_type']
        elastalert_logger.info("===============================self.metric_key: %s", self.metric_key)

        # self.rules['bucket_interval_period'] = '1m'

        if not self.rules['metric_agg_type'] in self.allowed_aggregations:
            raise EAException("metric_agg_type must be one of %s" % (str(self.allowed_aggregations)))

        self.rules['aggregation_query_element'] = self.generate_aggregation_query()




        self.ref_window_filled_once = False

        # spike setup
        self.timeframe = self.rules['timeframe']
        # #elastalert_logger.info("===============================str self.timeframe: %s" % str(self.timeframe))

        self.ref_windows = {}
        self.cur_windows = {}
        # # #elastalert_logger.info("===============================str self.ts_field: %s" % str(self.ts_field))

        self.get_ts = new_get_event_ts("key")
        self.first_event = {}
        self.skip_checks = {}
Esempio n. 4
0
 def __init__(self, timeframe, onRemoved=None, getTimestamp=new_get_event_ts('@timestamp')):
     self.timeframe = timeframe
     self.onRemoved = onRemoved
     self.get_ts = getTimestamp
     self.data = sortedlist(key=self.get_ts)
     self.running_count = 0
Esempio n. 5
0
 def __init__(self, *args):
     super(FrequencyRule, self).__init__(*args)
     self.ts_field = self.rules.get('timestamp_field', '@timestamp')
     self.get_ts = new_get_event_ts(self.ts_field)
     self.attach_related = self.rules.get('attach_related', False)
Esempio n. 6
0
 def __init__(self, timeframe, onRemoved=None, getTimestamp=new_get_event_ts('@timestamp')):
     self.timeframe = timeframe
     self.onRemoved = onRemoved
     self.get_ts = getTimestamp
     self.data = sortedlist(key=self.get_ts)
     self.running_count = 0
Esempio n. 7
0
 def __init__(self, *args):
     super(FrequencyRule, self).__init__(*args)
     self.ts_field = self.rules.get('timestamp_field', '@timestamp')
     self.get_ts = new_get_event_ts(self.ts_field)
     self.attach_related = self.rules.get('attach_related', False)