Skip to content

Commit

Permalink
Merge pull request #2438 from gza/fix_pipe_to_command
Browse files Browse the repository at this point in the history
Fix command alert with piped match data
  • Loading branch information
Qmando authored Sep 3, 2019
2 parents 3affdd7 + 0022a01 commit e82ab25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions elastalert/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,10 +918,10 @@ def alert(self, matches):

if self.rule.get('pipe_match_json'):
match_json = json.dumps(matches, cls=DateTimeEncoder) + '\n'
stdout, stderr = subp.communicate(input=match_json)
stdout, stderr = subp.communicate(input=match_json.encode())
elif self.rule.get('pipe_alert_text'):
alert_text = self.create_alert_body(matches)
stdout, stderr = subp.communicate(input=alert_text)
stdout, stderr = subp.communicate(input=alert_text.encode())
if self.rule.get("fail_on_non_zero_exit", False) and subp.wait():
raise EAException("Non-zero exit code while running command %s" % (' '.join(command)))
except OSError as e:
Expand Down

0 comments on commit e82ab25

Please sign in to comment.