fluent-plugin-riemann-tulos 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 45b49e95f4de48fd3ba77e175bec10140271e4de
4
+ data.tar.gz: c59d1bccb998aeb1183071846b0af81f33283691
5
+ SHA512:
6
+ metadata.gz: aebd36e44876de56aed8d5ae2e65d182cfb1db85cf38945f3c0f693861db6b45f8443371cefcd7af0d43a26919f9c9bda9cb67bd6a83e37a63602ffa6b182c13
7
+ data.tar.gz: 47eee866f1f7b602e1735f517885a975c9b139a93756bea9b18cb766a5c91e235377e22fff56160b0d2d92e20f48a5fe21a1e5bd9abf20d11dda13df226ddc9a
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+
19
+ fluent.conf
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-riemann.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Will Farrell
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # Fluent::Plugin::Riemann
2
+
3
+ `fluent-plugin-riemann` is a [fluentd](http://fluentd.org/ "Fluentd") output plugin that allows you to forward logs collected with fluentd to [riemann](http://riemann.io "Riemann").
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'fluent-plugin-riemann'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install fluent-plugin-riemann
18
+
19
+ ## Usage
20
+
21
+ <match riemann.**>
22
+ type riemann
23
+ host localhost
24
+ port 5555
25
+ timeout 5
26
+ protocol tcp
27
+ service test log messages
28
+ fields message:description,level:state,metric
29
+ types metric:float
30
+ flush_interval 10s
31
+ </match>
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( http://github.com/wkf/fluent-plugin-riemann/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "fluent-plugin-riemann-tulos"
7
+ spec.version = "0.0.4"
8
+ spec.authors = ["Will Farrell"]
9
+ spec.email = ["will@mojotech.com"]
10
+ spec.summary = %q{Riemann output plugin for Fluent}
11
+ spec.description = spec.summary
12
+ spec.homepage = "https://github.com/wkf/fluent-plugin-riemann"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency 'fluentd', '~> 0'
21
+ spec.add_runtime_dependency 'riemann-client', '~> 0'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "pry"
26
+ end
@@ -0,0 +1,77 @@
1
+ require 'riemann/client'
2
+
3
+ class Fluent::RiemannOutput < Fluent::BufferedOutput
4
+ Fluent::Plugin.register_output('riemann', self)
5
+
6
+ config_param :host, :string, :default => '127.0.0.1'
7
+ config_param :riemannport, :integer, :default => 5555
8
+ config_param :timeout, :integer, :default => 5
9
+ config_param :protocol, :string, :default => 'tcp'
10
+ config_param :service, :string, :default => nil
11
+ config_param :types, :string, :default => 'metric:float'
12
+ config_param :fields, :string, :default => 'message:description,level:state,metric'
13
+
14
+ def initialize
15
+ super
16
+ end
17
+
18
+ def configure(c)
19
+ super
20
+
21
+ @_types = parse_map(@types) do |k, t|
22
+ case t
23
+ when "string" then "to_s"
24
+ when "integer" then "to_i"
25
+ when "float" then "to_f"
26
+ else t
27
+ end
28
+ end
29
+
30
+ @_fields = parse_map(@fields) { |k, f| (f || k).to_sym }
31
+ end
32
+
33
+ def start
34
+ super
35
+ end
36
+
37
+ def shutdown
38
+ super
39
+ end
40
+
41
+ def client
42
+ @_client ||= Riemann::Client.new :host => @host, :port => @riemannport, :timeout => @timeout
43
+ @protocol == 'tcp' ? @_client.tcp : @_client.udp
44
+ end
45
+
46
+ def format(tag, time, record)
47
+ [tag, time, record].to_msgpack
48
+ end
49
+
50
+ def write(chunk)
51
+ chunk.msgpack_each do |tag, time, record|
52
+ event = {
53
+ :time => time,
54
+ :service => @service,
55
+ :tags => tag.split('.')
56
+ }
57
+
58
+ @_fields.each { |k,v| event[v] = record[k] }
59
+ @_types.each { |k,t| event[k] = event[k].send(t) }
60
+
61
+ client << event
62
+ end
63
+ end
64
+
65
+ private
66
+
67
+ def parse_map(map, &block)
68
+ Hash[map.split(',').map do |m|
69
+ k, v = m.split(':').map(&:strip)
70
+ if block_given?
71
+ [k, yield(k, v)]
72
+ else
73
+ [k, v]
74
+ end
75
+ end]
76
+ end
77
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-riemann-tulos
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Will Farrell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ~>
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ name: fluentd
20
+ prerelease: false
21
+ type: :runtime
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ name: riemann-client
34
+ prerelease: false
35
+ type: :runtime
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '1.5'
47
+ name: bundler
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ name: rake
62
+ prerelease: false
63
+ type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ name: pry
76
+ prerelease: false
77
+ type: :development
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Riemann output plugin for Fluent
84
+ email:
85
+ - will@mojotech.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - Gemfile
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
95
+ - VERSION
96
+ - fluent-plugin-riemann.gemspec
97
+ - lib/fluent/plugin/out_riemann.rb
98
+ homepage: https://github.com/wkf/fluent-plugin-riemann
99
+ licenses:
100
+ - MIT
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.4.8
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Riemann output plugin for Fluent
122
+ test_files: []