Skip to content

oza/fluent-plugin-zmq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zeromq plugin for Fluentd

fluent-plugin-zmq provides an adaptor between fluentd and zeromq.

Getting Started

Setup the ZeroMQ input:

    <source>
      type zmq
      port 4444
    </source>

Run a sample code.

    #!/usr/bin/env ruby
    require 'zmq'
    require 'msgpack'
    
    z = ZMQ::Context.new
    s = z.socket(ZMQ::DOWNSTREAM)
    s.connect("tcp://127.0.0.1:4444")
    tag = "debug.test"
    # echo '{"json":"message"}' | fluent-cat debug.test
    array = ["key" => "value"]
    
    def write_impl(s, tag, array)
      begin
        s.send([tag, Time.now.to_s, array].to_msgpack)
      rescue
        $stderr.puts "write failed: #{$!}"
        s.close
        return false
      end
    
      return true
    end
    
    write_impl(s, tag, array)

That's done. Happy logging with zeromq and fluetnd! :)

TODO

  • ZeroMQ output
  • ZeroMQ forwarding
  • JSON support

About

0MQ plugin for fluent Event Collector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages