Imap input filter - connection refused


(Vilas Reddy Podduturi) #1

Hi,

I am trying to use imap input filter. Using gmail account for testing purposes.
Config File

input {
	imap {
			host => "imap.gmail.com"
			user => "someuser@gmail.com"
			password => "somepassword"
			port => 993
			type => "imap"
	}
}

output {
	stdout { codec => rubydebug }
}

Output Error

←[31mA plugin had an unrecoverable error. Will restart this plugin.
  Plugin: <LogStash::Inputs::IMAP host=>"imap.gmail.com", user=>"someuser@gmail.com", type=>"imap", content_type=>"text/plain">
  Error: Connection refused - Connection refused {:level=>:error}←[0m
←[31mA plugin had an unrecoverable error. Will restart this plugin.
  Plugin: <LogStash::Inputs::IMAP host=>"imap.gmail.com", user=>"someuser@gmail.com", type=>"imap", content_type=>"text/plain">
  Error: Connection refused - Connection refused {:level=>:error}←[0m
IOError: closed stream
        close at org/jruby/RubyIO.java:2096
     teardown at C:/Tools/logstash-1.4.2/lib/logstash/inputs/imap.rb:145
  inputworker at C:/Tools/logstash-1.4.2/lib/logstash/pipeline.rb:184
  start_input at C:/Tools/logstash-1.4.2/lib/logstash/pipeline.rb:157

Please suggest what could be the issue here

Thanks


(Magnus Bäck) #2

imap.gmail.com:993 should be available for connections. I'm able to connect. What if you try yourself with telnet (telnet imap.gmail.com 993)? Until that works there's no point trying with Logstash.


(Vilas Reddy Podduturi) #3

Thanks for your reply @magnusbaeck
I tried the telnet and it is not connecting. I am currently trying to understand why.

So, I am using another email domain credentials. Now I am able to see some email being received.
But I have problem with character encoding.

[33mReceived an event that has a different character encoding than you configured.

My email server is microsoft exchange server.

Is it related to content-type? Please suggest.

Thanks.


(Magnus Bäck) #4

You may have to set a different codec (although I think the imap input should do this automatically based on each message's character set):

input {
  imap {
    ...
    codec => plain {
      charset => "some-charset-that-matches-your-data"
    }
  }
}

See the plain codec documentation for a list of valid character sets.


(Vilas Reddy Podduturi) #5

It tried this:

codec => plain {
	charset => "Windows-1255"
}

I got this charset from email header.
Logstash is crashing with this error:

 Error: undefined method `encode' for nil:NilClass {:level=>:error}←[0m

(system) #6