Check if date range is equal to
This commit is contained in:
parent
1964ab62ec
commit
c08ecc036f
|
@ -260,8 +260,8 @@ class ElasticsearchBackend(StorageBackend):
|
||||||
range_query = {
|
range_query = {
|
||||||
"range": {
|
"range": {
|
||||||
"ts": {
|
"ts": {
|
||||||
"gt": f"now-{rule_object.window}/d",
|
"gte": f"now-{rule_object.window}/d",
|
||||||
"lt": "now/d",
|
"lte": "now/d",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,6 +284,8 @@ class ElasticsearchBackend(StorageBackend):
|
||||||
search_query,
|
search_query,
|
||||||
index=index,
|
index=index,
|
||||||
)
|
)
|
||||||
|
self.log.debug(f"Running scheduled query on {index}: {search_query}")
|
||||||
|
self.log.debug(f"Response from scheduled query: {response}")
|
||||||
if isinstance(response, Exception):
|
if isinstance(response, Exception):
|
||||||
error = response.info["error"]["root_cause"][0]["reason"]
|
error = response.info["error"]["root_cause"][0]["reason"]
|
||||||
self.log.error(f"Error running scheduled search: {error}")
|
self.log.error(f"Error running scheduled search: {error}")
|
||||||
|
|
|
@ -205,6 +205,7 @@ class NotificationRuleData(object):
|
||||||
A rule has matched.
|
A rule has matched.
|
||||||
"""
|
"""
|
||||||
current_match = self.get_match(index)
|
current_match = self.get_match(index)
|
||||||
|
log.debug(f"Rule matched: {index} - current match: {current_match}")
|
||||||
if current_match is False:
|
if current_match is False:
|
||||||
# Matched now, but not before
|
# Matched now, but not before
|
||||||
formatted_aggs = self.format_aggs(aggs)
|
formatted_aggs = self.format_aggs(aggs)
|
||||||
|
@ -216,6 +217,7 @@ class NotificationRuleData(object):
|
||||||
A rule has not matched.
|
A rule has not matched.
|
||||||
"""
|
"""
|
||||||
current_match = self.get_match(index)
|
current_match = self.get_match(index)
|
||||||
|
log.debug(f"Rule not matched: {index} - current match: {current_match}")
|
||||||
if current_match is True:
|
if current_match is True:
|
||||||
# Matched before, but not now
|
# Matched before, but not now
|
||||||
if self.object.send_empty:
|
if self.object.send_empty:
|
||||||
|
|
Loading…
Reference in New Issue