Permalink
Browse files

fix issue where long alert summaries cause mozdefbot to exit

  • Loading branch information...
ameihm0912 committed Apr 11, 2016
1 parent 1f4799e commit 56ef591f4efa8864425a2dc5e53034a7c0b4e538
Showing with 3 additions and 0 deletions.
  1. +3 −0 bot/mozdefbot.py
View
@@ -339,6 +339,9 @@ def on_message(self, body, message):
sys.stdout.write('throttling before writing next alert\n')
time.sleep(1)
self.lastalert = toUTC(datetime.now())
if len(bodyDict['summary']) > 450:
sys.stdout.write('alert is more than 450 bytes, truncating\n')
bodyDict['summary'] = bodyDict['summary'][:450] + ' truncated...'
self.ircBot.client.msg(ircchannel, formatAlert(bodyDict))
message.ack()

0 comments on commit 56ef591

Please sign in to comment.