fluent-plugin-katsubushi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +13 -0
- data/README.md +24 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fluent-plugin-katsubushi.gemspec +25 -0
- data/lib/fluent/plugin/filter_katsubushi.rb +41 -0
- metadata +110 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: a9ab028ebaa105820e34ab7c12083af1b30613fa
|
|
4
|
+
data.tar.gz: 1916e9d82205e4b2d7a36006b7d8c873f32eab96
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ea9a1126799f819ab6d062b32ddf4761b196159014bce54d97cac1dfe9f7511715033579262ab395f14270d5cc4e3da2082bfdfd41a7daf2958c095b76cb9fbf
|
|
7
|
+
data.tar.gz: 555ff28b8555cf54acf54a5c16d338958f8457d733b2a85a9c0b8d7fa628b1de377666162aed637ece25cf01e8ddaadc27942d13b317e646f11099b28298cb9f
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2016 FUJIWARA Shunichiro
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Fluent::Plugin::Katsubushi
|
|
2
|
+
|
|
3
|
+
A [Fluentd](http://fluentd.org) filter plugin to inject an id getting from [katsubushi](https://github.com/kayac/go-katsubushi).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<filter>
|
|
9
|
+
@type katsubushi
|
|
10
|
+
id_key id
|
|
11
|
+
integer true
|
|
12
|
+
host localhost
|
|
13
|
+
port 11212
|
|
14
|
+
</filter>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Contributing
|
|
18
|
+
|
|
19
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/fujiwara/fluent-plugin-katsubushi.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## License
|
|
23
|
+
|
|
24
|
+
Apache License, Version 2.0
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "fluent/plugin/katsubushi"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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-katsubushi"
|
|
7
|
+
spec.version = "0.1.0"
|
|
8
|
+
spec.authors = ["FUJIWARA Shunichiro"]
|
|
9
|
+
spec.email = ["fujiwara.shunichiro@gmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = %q{A fluentd filter plugin to inject id getting from katsubushi.}
|
|
12
|
+
spec.description = %q{A fluentd filter plugin to inject id getting from katsubushi.}
|
|
13
|
+
spec.homepage = "https://github.com/fujiwara/fluent-plugin-katsubushi"
|
|
14
|
+
spec.license = "Apache-2.0"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
17
|
+
spec.bindir = "exe"
|
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
23
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
|
24
|
+
spec.add_dependency "memcached", "~> 1.8.0"
|
|
25
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
module Fluent
|
|
3
|
+
class KatsubushiFilter < Filter
|
|
4
|
+
require 'memcached'
|
|
5
|
+
Fluent::Plugin.register_filter('katsubushi', self)
|
|
6
|
+
|
|
7
|
+
config_param :id_key, :string, :default => 'id'
|
|
8
|
+
config_param :integer, :bool, :default => true
|
|
9
|
+
config_param :host, :string, :default => 'localhost'
|
|
10
|
+
config_param :port, :integer, :default => 11212
|
|
11
|
+
|
|
12
|
+
def configure(conf)
|
|
13
|
+
super
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def start
|
|
17
|
+
super
|
|
18
|
+
@client = ::Memcached.new(["#{@host}:#{@port}"])
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def shutdown
|
|
22
|
+
super
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def filter(tag, time, record)
|
|
26
|
+
tries = 3
|
|
27
|
+
while tries >= 0 do
|
|
28
|
+
begin
|
|
29
|
+
id = @client.get('1', false)
|
|
30
|
+
record[@id_key] = @integer ? id.to_i : id.to_s
|
|
31
|
+
rescue => e
|
|
32
|
+
$log.warn("Couldn't get id from katsubushi: #{e}") if tries == 0
|
|
33
|
+
@client.reset
|
|
34
|
+
ensure
|
|
35
|
+
tries = tries - 1
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
record
|
|
39
|
+
end
|
|
40
|
+
end if defined?(Filter) # Support only >= v0.12
|
|
41
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fluent-plugin-katsubushi
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- FUJIWARA Shunichiro
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.12'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.12'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: minitest
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '5.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '5.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: memcached
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 1.8.0
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 1.8.0
|
|
69
|
+
description: A fluentd filter plugin to inject id getting from katsubushi.
|
|
70
|
+
email:
|
|
71
|
+
- fujiwara.shunichiro@gmail.com
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- ".gitignore"
|
|
77
|
+
- ".travis.yml"
|
|
78
|
+
- Gemfile
|
|
79
|
+
- LICENSE.txt
|
|
80
|
+
- README.md
|
|
81
|
+
- Rakefile
|
|
82
|
+
- bin/console
|
|
83
|
+
- bin/setup
|
|
84
|
+
- fluent-plugin-katsubushi.gemspec
|
|
85
|
+
- lib/fluent/plugin/filter_katsubushi.rb
|
|
86
|
+
homepage: https://github.com/fujiwara/fluent-plugin-katsubushi
|
|
87
|
+
licenses:
|
|
88
|
+
- Apache-2.0
|
|
89
|
+
metadata: {}
|
|
90
|
+
post_install_message:
|
|
91
|
+
rdoc_options: []
|
|
92
|
+
require_paths:
|
|
93
|
+
- lib
|
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
|
+
requirements:
|
|
96
|
+
- - ">="
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: '0'
|
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
requirements: []
|
|
105
|
+
rubyforge_project:
|
|
106
|
+
rubygems_version: 2.5.1
|
|
107
|
+
signing_key:
|
|
108
|
+
specification_version: 4
|
|
109
|
+
summary: A fluentd filter plugin to inject id getting from katsubushi.
|
|
110
|
+
test_files: []
|