custom plugin installation into MacOs- td-agent-gem

258 views
Skip to first unread message

learning

unread,
Jan 12, 2017, 9:45:24 AM1/12/17
to Fluentd Google Group
module Fluent
    class SplitMsgFilter < Filter
        Fluent::Plugin.register_output('split_msg', self)  

        # config_param works like other plugins

        def configure(conf)

            super

        end
        def filter(tag, time, record)

            msgs = record['message'].split("\|")

            event_time = msgs[0]

            ip = msgs[2]

            # replace profile4 or add ip to record or etc...

            record

        end

    end

end

I wanted to use this plugin but when I try to install this custom plugin into MacOs  using the following command

td-agent-gem ~/filter_split_msg.rb 


ERROR:  While executing gem ... (Gem::CommandLineError)

    Unknown command ~/filter_split_msg.rb


what I am doing wrong here?.



Mr. Fiber

unread,
Jan 12, 2017, 9:51:32 AM1/12/17
to Fluentd Google Group
This official article may help: http://docs.fluentd.org/articles/plugin-management


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.

learning

unread,
Jan 12, 2017, 10:13:19 AM1/12/17
to Fluentd Google Group
fluentd -p /path/to/plugin

fluentd -p ~/filter_split_msg.rb 

2017-01-12 10:10:27 -0500 [info]: reading config file path="/etc/fluent/fluent.conf"

/usr/local/lib/ruby/gems/2.3.0/gems/fluentd-0.14.9/lib/fluent/supervisor.rb:659:in `read': No such file or directory @ rb_sysopen - /etc/fluent/fluent.conf (Errno::ENOENT)

from /usr/local/lib/ruby/gems/2.3.0/gems/fluentd-0.14.9/lib/fluent/supervisor.rb:659:in `read_config'

from /usr/local/lib/ruby/gems/2.3.0/gems/fluentd-0.14.9/lib/fluent/supervisor.rb:416:in `run_supervisor'

from /usr/local/lib/ruby/gems/2.3.0/gems/fluentd-0.14.9/lib/fluent/command/fluentd.rb:286:in `<top (required)>'

from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:58:in `require'

from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:58:in `require'

from /usr/local/lib/ruby/gems/2.3.0/gems/fluentd-0.14.9/bin/fluentd:5:in `<top (required)>'

from /usr/local/bin/fluentd:23:in `load'

from /usr/local/bin/fluentd:23:in `<main>'


I have tried this too.

To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+u...@googlegroups.com.

Mr. Fiber

unread,
Jan 12, 2017, 10:14:41 AM1/12/17
to Fluentd Google Group
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+unsubscribe@googlegroups.com.

learning

unread,
Jan 13, 2017, 10:09:56 AM1/13/17
to Fluentd Google Group
Thanks for the details. Sorry for asking many questions . I am really a beginner on fluentd and trying to understand 

above custom filter what should be entry in conf file .

I tried as follows but got an error. 

<filter test>

@type split_msg


</filter>


2017-01-13 10:08:22 -0500 [error]: config error file="/etc/fluent/fluent.conf" error="Unknown filter plugin 'split_msg'. Run 'gem search -rd fluent-plugin' to find plugins"

Mr. Fiber

unread,
Jan 13, 2017, 10:26:47 AM1/13/17
to Fluentd Google Group
Fluent::Plugin.register_output('split_msg', self)  

Should be "Fluent::Plugin.register_filter('split_msg', self)"

To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+unsubscribe@googlegroups.com.

learning

unread,
Jan 13, 2017, 10:38:46 AM1/13/17
to Fluentd Google Group
It is 'Fluent::Plugin.register_output('split_msg', self) '

using inside config

<filter test>

@type split_msg

</filter>


module Fluent
   
class SplitMsgFilter < Filter
       
Fluent::Plugin.register_output('split_msg', self)  
       
# config_param works like other plugins

       
def configure(conf)

           
super

       
end
       
def filter(tag, time, record)

            msgs
= record['message'].split("\|")

            event_time
= msgs[0]

            ip
= msgs[2]

           
# replace profile4 or add ip to record or etc...

            record

       
end

   
end

end

learning

unread,
Jan 13, 2017, 10:41:38 AM1/13/17
to Fluentd Google Group
Sorry My Mistake
Reply all
Reply to author
Forward
0 new messages