Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds --silence_qk_value option to elastalert #2795

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion elastalert/elastalert.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def parse_args(self, args):
parser.add_argument('--rule', dest='rule', help='Run only a specific rule (by filename, must still be in rules folder)')
parser.add_argument('--silence', dest='silence', help='Silence rule for a time period. Must be used with --rule. Usage: '
'--silence <units>=<number>, eg. --silence hours=2')
parser.add_argument(
"--silence_qk_value",
dest="silence_qk_value",
help="Silence the rule only for this specific query key value.",
)
parser.add_argument('--start', dest='start', help='YYYY-MM-DDTHH:MM:SS Start querying from this timestamp. '
'Use "NOW" to start from current time. (Default: present)')
parser.add_argument('--end', dest='end', help='YYYY-MM-DDTHH:MM:SS Query to this timestamp. (Default: present)')
Expand Down Expand Up @@ -1853,7 +1858,10 @@ def silence(self, silence_cache_key=None):

# With --rule, self.rules will only contain that specific rule
if not silence_cache_key:
silence_cache_key = self.rules[0]['name'] + "._silence"
if self.args.silence_qk_value:
silence_cache_key = self.rules[0]['name'] + "." + self.args.silence_qk_value
else:
silence_cache_key = self.rules[0]['name'] + "._silence"

try:
silence_ts = parse_deadline(self.args.silence)
Expand Down