Skip to content

Commit e82ab25

Browse files
authored
Merge pull request Yelp#2438 from gza/fix_pipe_to_command
Fix command alert with piped match data
2 parents 3affdd7 + 0022a01 commit e82ab25

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

elastalert/alerts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -918,10 +918,10 @@ def alert(self, matches):
918918

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

0 commit comments

Comments
 (0)