Error: No implicit conversion of nil into String

1,022 views
Skip to first unread message

User7861

unread,
Feb 4, 2018, 11:45:55 PM2/4/18
to Fluentd Google Group
Hi,

I have installed and configured fluentD in CentOS 7.4 using the script curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent3.sh | sh. Now I'm getting some error while fluentD pushing data to elastic search. Here is the /var/log/td-agent/td-agent output.

2018-02-05 10:04:02 +0530 [warn]: #0 dump an error event: error_class=TypeError error="no implicit conversion of nil into String" location="/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-elasticsearch-2.4.0/lib/fluent/plugin/out_elasticsearch_dynamic.rb:263:in `sub!'" tag="fluent.info" time=#<Fluent::EventTime:0x00007f118c973a20 @sec=1517805182, @nsec=53991600> record={"worker"=>0, "message"=>"fluentd worker is now running worker=0"}

2018-02-05 10:04:35 +0530 [info]: #0 Connection opened to Elasticsearch cluster => {:host=>"localhost", :port=>9200, :scheme=>"http"}
2018-02-05 10:05:02 +0530 [warn]: #0 dump an error event: error_class=TypeError error="no implicit conversion of nil into String" location="/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-elasticsearch-2.4.0/lib/fluent/plugin/out_elasticsearch_dynamic.rb:263:in `sub!'" tag="fluent.warn" time=#<Fluent::EventTime:0x00007f118c8e08d8 @sec=1517805242, @nsec=58672400> record={"error"=>"#<TypeError: no implicit conversion of nil into String>", "location"=>"/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-elasticsearch-2.4.0/lib/fluent/plugin/out_elasticsearch_dynamic.rb:263:in `sub!'", "tag"=>"fluent.info", "time"=>#<Fluent::EventTime:0x00007f118c8e06d0 @sec=1517805182, @nsec=53991600>, "record"=>{"worker"=>0, "message"=>"fluentd worker is now running worker=0"}, "message"=>"dump an error event: error_class=TypeError error=\"no implicit conversion of nil into String\" location=\"/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-elasticsearch-2.4.0/lib/fluent/plugin/out_elasticsearch_dynamic.rb:263:in `sub!'\" tag=\"fluent.info\" time=#<Fluent::EventTime:0x00007f118c973a20 @sec=1517805182, @nsec=53991600> record={\"worker\"=>0, \"message\"=>\"fluentd worker is now running worker=0\"}"}
2018-02-05 10:05:40 +0530 [warn]: #0 dump an error event: error_class=TypeError error="no implicit conversion of nil into String" location="/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-elasticsearch-2.4.0/lib/fluent/plugin/out_elasticsearch_dynamic.rb:263:in `sub!'" tag="fluent.info" time=#<Fluent::EventTime:0x00007f118c8c4098 @sec=1517805275, @nsec=81823700> record={"message"=>"Connection opened to Elasticsearch cluster => {:host=>\"localhost\", :port=>9200, :scheme=>\"http\"}"}

[root@localhost ~]# td-agent --version
td
-agent 1.0.2
[root@localhost ~]#

Thanks.

Mr. Fiber

unread,
Feb 6, 2018, 8:53:40 AM2/6/18
to Fluentd Google Group
You don't paste your configuration so this is just assumption.
You access not existing field in elasticsearch_dynamic.


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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sona sun

unread,
Sep 23, 2019, 4:36:24 AM9/23/19
to Fluentd Google Group
Did you get answer to this problem?? Actually i've same issue of "No implicit conversion Integer to String"

<filter company.logging.alarm>
  @type brevity_control
  interval 15s
  num 2
  attr_keys alarm.id, alarm.severity
  max_slot_num 100000
  stats_msg_fields alarm.key, alarm.idalarm.name, alarm.data
  stats_msg_tag nokia.logging.log
  all_keys_used true
</filter>

#0 emit transaction failed: error_class=TypeError error="no implicit conversion of Integer into String" location="/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-brevity-control-0.0.2/lib/fluent/plugin/filter_brevity_control.rb:33:in `+'" tag="syslog.user.notice"
To unsubscribe from this group and stop receiving emails from it, send an email to flu...@googlegroups.com.

sona sun

unread,
Sep 23, 2019, 9:02:08 AM9/23/19
to Fluentd Google Group
Ok i went through this plugin configuration. https://github.com/nokia/fluent-plugin-brevity-control/blob/master/lib/fluent/plugin/filter_brevity_control.rb


require 'fluent/plugin/filter'
module Fluent::Plugin
class BrevityControlFilter < Fluent::Plugin::Filter
Fluent::Plugin.register_filter('brevity_control', self)
config_param :attr_keys, :string, default: nil
config_param :num, :integer, default: 3
config_param :max_slot_num, :integer, default: 100000
config_param :interval, :integer, default: 300
config_param :stats_msg_tag, :string, default: nil
config_param :stats_msg_fields, :string, default: nil
config_param :all_keys_used, :bool, default: true
def configure(conf)
super
@keys = @attr_keys ? @attr_keys.split(/ *, */) : nil
@fields = @stats_msg_fields ? @stats_msg_fields.split(/ *, */) : nil
@slots = {}
end
def filter_stream(tag, es)
new_es = Fluent::MultiEventStream.new
es.each do |time, record|
#log.debug "receive record: " + record.to_s
#log.debug "hash : " + @slots.to_s
if @keys
values = @keys.map do |key|
value=key.split(/\./).inject(record) do |r, k|
break unless r.has_key?(k)
r[k]
end
value ? key+"="+value : nil
end



Is the error i'm receiving because alarm.id is Integer but attr_keys accepts String.
If yes, then i need to use to_s function

attr_keys alarm.id.to_s, alarm.severity


 BUt is there way that i change plugin configuartion in such a way that it internally converts any data type to string. I mean like
@keys = @attr_keys ? @attr_keys.to_s.split(/ *, */) : nil
Reply all
Reply to author
Forward
0 new messages