Not able to send email

113 views
Skip to first unread message

Rohit Sharma

unread,
Mar 23, 2016, 12:46:16 AM3/23/16
to Fluentd Google Group
Hi,

I am following below article to implement mail alert logging from fluentd, but not able to receive email notifications.



Below is fluentd debug output, kindly help me out to troubleshoot this issue.

[root@ip-172-21-16-59 bin]# ./fluentd -c /etc/td-agent/td-agent.conf -vv
2016-03-23 10:05:23 +0530 [info]: fluent/supervisor.rb:457:read_config: reading config file path="/etc/td-agent/td-agent.conf"
2016-03-23 10:05:23 +0530 [info]: fluent/supervisor.rb:323:supervise: starting fluentd-0.12.20
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered buffer plugin 'file'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered buffer plugin 'memory'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered filter plugin 'grep'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered filter plugin 'record_transformer'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered filter plugin 'stdout'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'debug_agent'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'dummy'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'exec'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'forward'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'gc_stat'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'http'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'monitor_agent'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'object_space'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'status'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'unix'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'syslog'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'tail'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'tcp'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered input plugin 'udp'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'copy'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'exec'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'exec_filter'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'file'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'forward'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'null'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'relabel'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'roundrobin'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'stdout'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'tcp'
2016-03-23 10:05:23 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'unix'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-mixin-config-placeholders' version '0.3.1'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-mixin-plaintextformatter' version '0.2.6'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-dynamodb' version '0.1.11'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-elasticsearch' version '1.4.0'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-grepcounter' version '0.5.6'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-loggly' version '0.0.7'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-mail' version '0.2.4'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-mongo' version '0.7.12'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-parser' version '0.6.0'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-record-reformer' version '0.8.0'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-rewrite-tag-filter' version '1.5.4'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-s3' version '0.6.5'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-scribe' version '0.10.14'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-tail-multiline' version '0.1.5'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-td' version '0.10.28'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-td-monitoring' version '0.2.2'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluent-plugin-webhdfs' version '0.4.1'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluentd' version '0.12.20'
2016-03-23 10:05:23 +0530 [info]: fluent/engine.rb:114:block in configure: gem 'fluentd' version '0.10.61'
2016-03-23 10:05:23 +0530 [info]: fluent/agent.rb:125:add_match: adding match pattern="**" type="copy"
2016-03-23 10:05:23 +0530 [debug]: plugin/out_copy.rb:40:block in configure: adding store type="elasticsearch"
2016-03-23 10:05:24 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'elasticsearch'
2016-03-23 10:05:24 +0530 [debug]: plugin/out_copy.rb:40:block in configure: adding store type="stdout"
2016-03-23 10:05:24 +0530 [info]: fluent/agent.rb:125:add_match: adding match pattern="**s" type="grepcounter"
2016-03-23 10:05:24 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'grepcounter'
2016-03-23 10:05:24 +0530 [info]: fluent/agent.rb:125:add_match: adding match pattern="**" type="copy"
2016-03-23 10:05:24 +0530 [debug]: plugin/out_copy.rb:40:block in configure: adding store type="stdout"
2016-03-23 10:05:24 +0530 [debug]: plugin/out_copy.rb:40:block in configure: adding store type="mail"
2016-03-23 10:05:24 +0530 [trace]: fluent/plugin.rb:118:register_impl: registered output plugin 'mail'
2016-03-23 10:05:24 +0530 [info]: fluent/agent.rb:125:add_match: adding match pattern="**" type="forward"
2016-03-23 10:05:24 +0530 [info]: plugin/out_forward.rb:141:block in configure: adding forwarding server '127.0.0.1:24224' host="127.0.0.1" port=24224 weight=20 plugin_id="object:1331868"
2016-03-23 10:05:24 +0530 [info]: fluent/root_agent.rb:143:add_source: adding source type="forward"
2016-03-23 10:05:24 +0530 [info]: fluent/root_agent.rb:143:add_source: adding source type="tail"
2016-03-23 10:05:24 +0530 [info]: fluent/engine.rb:121:configure: using configuration file: <ROOT>
  <match **>
    type copy
    <store>
      type elasticsearch
      include_tag_key true
      tag_key @test_log
      logstash_format true
      flush_interval 5s
      host 172.21.16.215
      port 9200
      index_name fluentd
      type_name fluentd
    </store>
    <store>
      type stdout
    </store>
  </match>
  <source>
    type forward
  </source>
  <match **>
    type grepcounter
    count_interval 1
    input_key code
    regexp ^e[a-z]*$
    threshold 1
    add_tag_prefix error_5xx
  </match>
  <match **>
    type copy
    <store>
      type stdout
    </store>
    <store>
      type mail
      host smtp.gmail.com
      port 587
      user rohi...@gmail.com
      password xxxxxx
      enable_starttls_auto true
      from rohi...@gmail.com
      to rohi...@gmail.com
      subject [URGENT]  ERROR
      message Total error count: %s\n\nPlease check your server ASAP
      message_out_keys count
    </store>
  </match>
  <match **>
    type forward
    send_timeout 10s
    recover_wait 5s
    heartbeat_interval 1s
    phi_threshold 16
    hard_timeout 60s
    <server>
      host 127.0.0.1
      port 24224
      weight 20
    </server>
  </match>
  <source>
    type tail
    format none
    path /tmp/test
    tag transcode_logs.log
    pos_file /tmp/td-agent.pos
  </source>
</ROOT>
2016-03-23 10:05:24 +0530 [debug]: plugin/out_forward.rb:232:rebuild_weight_array: rebuilding weight array lost_weight=0
2016-03-23 10:05:24 +0530 [info]: plugin/in_forward.rb:81:listen: listening fluent socket on 0.0.0.0:24224
2016-03-23 10:05:24 +0530 [info]: plugin/in_tail.rb:499:initialize: following tail of /tmp/test


2016-03-23 10:05:45 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:46 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:47 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:49 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:50 +0530 [info]: plugin/out_elasticsearch.rb:117:client: Connection opened to Elasticsearch cluster => {:host=>"172.21.16.215", :port=>9200, :scheme=>"http"}
2016-03-23 10:05:50 +0530 fluent.info: {"message":"Connection opened to Elasticsearch cluster => {:host=>\"172.21.16.215\", :port=>9200, :scheme=>\"http\"}","@test_log":"fluent.info"}
2016-03-23 10:05:50 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:51 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:52 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:53 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:53 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:54 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}
2016-03-23 10:05:54 +0530 transcode_logs.log: {"message":"error","@test_log":"transcode_logs.log"}

-Rohit


Mr. Fiber

unread,
Mar 23, 2016, 1:47:58 AM3/23/16
to Fluentd Google Group
See this article: http://docs.fluentd.org/articles/config-file#match-order
Using same match patterns, <match **> in this case, is bad.


Masahiro

--
You received this message because you are subscribed to the Google Groups "Fluentd Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rohit Sharma

unread,
Mar 23, 2016, 1:55:03 AM3/23/16
to Fluentd Google Group

Hi Masahiro,


I have changed my configuration. now its looks like below also now using local postfix mta to check mail delivery.

Still facing same issue :(

<match transcode_logs.log>
  type grepcounter
  count_interval 1
  input_key message
  regexp error
  exclude favicon.ico
  threshold 1
  add_tag_prefix warn.count
</match>

<match transcode_logs.log>
  type mail
  host localhost
  port 25
  from root@localhost
  to ec2-user@localhost
  subject SUBJECT: %s
  subject_out_keys tag
  out_keys tag,foo,message
  time_locale UTC # optional
</match>

-Rohit

Mr. Fiber

unread,
Mar 23, 2016, 2:03:21 AM3/23/16
to Fluentd Google Group
It seems you still use same "transcode_logs.log" match pattern.
Is this typo?

Rohit Sharma

unread,
Mar 23, 2016, 2:21:07 AM3/23/16
to Fluentd Google Group

Hi,

Actually, i have created temporary file for testing named /tmp/test, where I am putting error string just to test this plugin, (later on will put original log file with proper tag)

<source>
  type tail
  format none
  path /tmp/test
  tag transcode_logs.log
  pos_file /tmp/td-agent.pos
</source>

I have tag this file to transcode_logs.log and I want if errors populate in this file to be notified via email.

Kindly let me know if I am missing anything in configuration which is causing this issue.

-Rohit

Mr. Fiber

unread,
Mar 23, 2016, 2:26:02 AM3/23/16
to Fluentd Google Group
I mentioned above.
The problem is same match pattern between output plugins setting.
Please set different match patter for grepcounter and email.
This is why grepcouter has add_tag_prefix parameter.
Maybe, warn.count.transcode_logs.log is enough.

Reply all
Reply to author
Forward
0 new messages