logstash silently (other than the two below log entries) dies when it tries to read an e-mail with an attachment.
{:timestamp=>"2015-05-27T11:58:52.925000-0700", :message=>"A plugin had an unrecoverable error. Will restart this plugin.\n Plugin: <LogStash::Inputs::IMAP type=>"mail", host=>"redacted", user=>"redacted", folder=>"INBOX", content_type=>"text/plain">\n Error: Can not decode an entire message, try calling #decoded on the various fields and body or parts if it is a multipart message.", :level=>:error}
{:timestamp=>"2015-05-27T11:58:55.792000-0700", :message=>"A plugin had an unrecoverable error. Will restart this plugin.\n Plugin: <LogStash::Inputs::IMAP type=>"mail", host=>"redacted", user=>"redacted", folder=>"INBOX", content_type=>"text/plain">\n Error: Can not decode an entire message, try calling #decoded on the various fields and body or parts if it is a multipart message.", :level=>:error}
I also see errors like the following that cause logstash to crash:
{:timestamp=>"2015-06-05T09:10:48.800000-0700", :message=>"A plugin had an unrecoverable error. Will restart this plugin.\n Plugin: <LogStash::Inputs::IMAP type=>"mail", host=>"redacted", user=>"redacted", folder=>"mail/dba-sqljobs", content_type=>"text/plain">\n Error: Bad file descriptor - Bad file descriptor", :level=>:error}
{:timestamp=>"2015-06-05T10:59:06.962000-0700", :message=>"A plugin had an unrecoverable error. Will restart this plugin.\n Plugin: <LogStash::Inputs::IMAP type=>"mail", host=>"redacted", user=>"redacted", folder=>"mail/dba-sqljobs", content_type=>"text/plain">\n Error: Bad file descriptor - Bad file descriptor", :level=>:error}
And in both cases, it takes two to cause logstash to die but it seems they can be an arbitrary amount of time between them.
I didn't actually find a solution but my workaround is:
Try and avoid the e-mails with attachments that cause the crash - I moved the mails that I wanted to ingest to a separate imap folder while avoiding the mails that I know cause problems. I used imapfilter - https://github.com/lefcha/imapfilter
I wrote a little cron script that detects when logstash crashes and restarts. Here's the script:
#!/bin/sh
ls_status=service logstash status
if [ "x$ls_status" != "xlogstash is running" ]
then
service logstash start;
echo "date - logstash not running - restarted" >> /tmp/logstash.log;
fi
Not pretty and don't think I'd use this for "production" but good enough for testing.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.