fluent-plugin-scribe 0.9.11 → 0.10.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.
- data/README.rdoc +1 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/fluent-plugin-scribe.gemspec +7 -5
- data/lib/fluent/plugin/in_scribe.rb +3 -3
- data/lib/fluent/plugin/out_scribe.rb +84 -0
- metadata +10 -9
data/README.rdoc
CHANGED
@@ -47,7 +47,7 @@ The following options are supported.
|
|
47
47
|
|
48
48
|
* port: port number (default: 1463)
|
49
49
|
* bind: bind address (default: 0.0.0.0)
|
50
|
-
* server_type: server architecture either in 'simple', 'threaded', 'thread_pool', 'nonblocking' (default:
|
50
|
+
* server_type: server architecture either in 'simple', 'threaded', 'thread_pool', 'nonblocking' (default: nonblocking)
|
51
51
|
* framed: use framed protocol or not (default: true)
|
52
52
|
|
53
53
|
== For Developers
|
data/Rakefile
CHANGED
@@ -9,10 +9,10 @@ begin
|
|
9
9
|
gemspec.summary = "Scribe plugin for Fluent event collector"
|
10
10
|
gemspec.author = "Kazuki Ohta"
|
11
11
|
#gemspec.email = "kazuki.ohta@gmail.com"
|
12
|
-
|
12
|
+
gemspec.homepage = "https://github.com/fluent/fluent-plugin-scribe"
|
13
13
|
gemspec.has_rdoc = false
|
14
14
|
gemspec.require_paths = ["lib"]
|
15
|
-
gemspec.add_dependency "
|
15
|
+
gemspec.add_dependency "fluentd", "~> 0.10.0"
|
16
16
|
gemspec.add_dependency "thrift", "~> 0.7.0"
|
17
17
|
gemspec.test_files = Dir["test/**/*.rb"]
|
18
18
|
gemspec.files = Dir["bin/**/*", "lib/**/*", "test/**/*.rb"] +
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fluent-plugin-scribe}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.10.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kazuki Ohta"]
|
12
|
-
s.date = %q{2011-10-
|
12
|
+
s.date = %q{2011-10-16}
|
13
13
|
s.extra_rdoc_files = [
|
14
14
|
"README.rdoc"
|
15
15
|
]
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
"example.conf",
|
22
22
|
"fluent-plugin-scribe.gemspec",
|
23
23
|
"lib/fluent/plugin/in_scribe.rb",
|
24
|
+
"lib/fluent/plugin/out_scribe.rb",
|
24
25
|
"lib/fluent/plugin/thrift/facebook_service.rb",
|
25
26
|
"lib/fluent/plugin/thrift/fb303.thrift",
|
26
27
|
"lib/fluent/plugin/thrift/fb303_constants.rb",
|
@@ -30,6 +31,7 @@ Gem::Specification.new do |s|
|
|
30
31
|
"lib/fluent/plugin/thrift/scribe_constants.rb",
|
31
32
|
"lib/fluent/plugin/thrift/scribe_types.rb"
|
32
33
|
]
|
34
|
+
s.homepage = %q{https://github.com/fluent/fluent-plugin-scribe}
|
33
35
|
s.require_paths = ["lib"]
|
34
36
|
s.rubygems_version = %q{1.6.2}
|
35
37
|
s.summary = %q{Scribe plugin for Fluent event collector}
|
@@ -38,14 +40,14 @@ Gem::Specification.new do |s|
|
|
38
40
|
s.specification_version = 3
|
39
41
|
|
40
42
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
41
|
-
s.add_runtime_dependency(%q<
|
43
|
+
s.add_runtime_dependency(%q<fluentd>, ["~> 0.10.0"])
|
42
44
|
s.add_runtime_dependency(%q<thrift>, ["~> 0.7.0"])
|
43
45
|
else
|
44
|
-
s.add_dependency(%q<
|
46
|
+
s.add_dependency(%q<fluentd>, ["~> 0.10.0"])
|
45
47
|
s.add_dependency(%q<thrift>, ["~> 0.7.0"])
|
46
48
|
end
|
47
49
|
else
|
48
|
-
s.add_dependency(%q<
|
50
|
+
s.add_dependency(%q<fluentd>, ["~> 0.10.0"])
|
49
51
|
s.add_dependency(%q<thrift>, ["~> 0.7.0"])
|
50
52
|
end
|
51
53
|
end
|
@@ -106,10 +106,10 @@ class ScribeInput < Input
|
|
106
106
|
def Log(msgs)
|
107
107
|
begin
|
108
108
|
msgs.each { |msg|
|
109
|
-
|
109
|
+
record = {
|
110
110
|
'message' => msg.message
|
111
|
-
}
|
112
|
-
Engine.emit(msg.category,
|
111
|
+
}
|
112
|
+
Engine.emit(msg.category, Engine.now, record)
|
113
113
|
}
|
114
114
|
return ResultCode::OK
|
115
115
|
rescue => e
|
@@ -0,0 +1,84 @@
|
|
1
|
+
#
|
2
|
+
# Fluent
|
3
|
+
#
|
4
|
+
# Copyright (C) 2011 Kazuki Ohta
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
module Fluent
|
19
|
+
|
20
|
+
class ScribeOutput < BufferedOutput
|
21
|
+
Fluent::Plugin.register_output('scribe', self)
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
super
|
25
|
+
require 'thrift'
|
26
|
+
$:.unshift File.join(File.dirname(__FILE__), 'thrift')
|
27
|
+
require 'fb303_types'
|
28
|
+
require 'fb303_constants'
|
29
|
+
require 'facebook_service'
|
30
|
+
require 'scribe_types'
|
31
|
+
require 'scribe_constants'
|
32
|
+
require 'scribe'
|
33
|
+
end
|
34
|
+
|
35
|
+
def configure(conf)
|
36
|
+
super
|
37
|
+
|
38
|
+
@host = 'localhost'
|
39
|
+
@port = 38888
|
40
|
+
end
|
41
|
+
|
42
|
+
def start
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
def shutdown
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
def format(tag, event)
|
51
|
+
[tag, event.record].to_msgpack
|
52
|
+
end
|
53
|
+
|
54
|
+
def write(chunk)
|
55
|
+
records = []
|
56
|
+
chunk.open { |io|
|
57
|
+
begin
|
58
|
+
MessagePack::Unpacker.new(io).each { |record| records << record }
|
59
|
+
rescue EOFError
|
60
|
+
# EOFError always occured when reached end of chunk.
|
61
|
+
end
|
62
|
+
}
|
63
|
+
|
64
|
+
socket = Thrift::Socket.new @host, @port.to_i
|
65
|
+
transport = Thrift::FramedTransport.new socket
|
66
|
+
protocol = Thrift::BinaryProtocol.new transport, false, false
|
67
|
+
client = Scribe::Client.new protocol
|
68
|
+
transport.open
|
69
|
+
|
70
|
+
entries = []
|
71
|
+
records.each { |r|
|
72
|
+
entry = LogEntry.new
|
73
|
+
entry.category = r[0]
|
74
|
+
entry.message = r[1].to_json
|
75
|
+
entries << entry
|
76
|
+
}
|
77
|
+
|
78
|
+
client.Log(entries)
|
79
|
+
transport.close
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-scribe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,23 +9,23 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-16 00:00:00.000000000 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
requirement: &
|
16
|
+
name: fluentd
|
17
|
+
requirement: &2153379240 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.10.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2153379240
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: thrift
|
28
|
-
requirement: &
|
28
|
+
requirement: &2153378640 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 0.7.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2153378640
|
37
37
|
description:
|
38
38
|
email:
|
39
39
|
executables: []
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- example.conf
|
49
49
|
- fluent-plugin-scribe.gemspec
|
50
50
|
- lib/fluent/plugin/in_scribe.rb
|
51
|
+
- lib/fluent/plugin/out_scribe.rb
|
51
52
|
- lib/fluent/plugin/thrift/facebook_service.rb
|
52
53
|
- lib/fluent/plugin/thrift/fb303.thrift
|
53
54
|
- lib/fluent/plugin/thrift/fb303_constants.rb
|
@@ -58,7 +59,7 @@ files:
|
|
58
59
|
- lib/fluent/plugin/thrift/scribe_types.rb
|
59
60
|
- README.rdoc
|
60
61
|
has_rdoc: true
|
61
|
-
homepage:
|
62
|
+
homepage: https://github.com/fluent/fluent-plugin-scribe
|
62
63
|
licenses: []
|
63
64
|
post_install_message:
|
64
65
|
rdoc_options: []
|