fluent-plugin-scribe 0.10.0 → 0.10.1
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 +8 -7
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/fluent/plugin/in_scribe.rb +8 -14
- data/test/plugin/in_scribe.rb +57 -0
- metadata +8 -6
data/README.rdoc
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
== Overview
|
4
4
|
|
5
|
-
This is a plugin for
|
5
|
+
This is a plugin for fluentd[https://github.com/fluentd] event collector. This plugin adds the Scribe[https://github.com/facebook/scribe] compatible interface to fluentd.
|
6
6
|
|
7
7
|
== What's Scribe?
|
8
8
|
|
9
9
|
Scribe[https://github.com/facebook/scribe] is a server for aggregating log data streamed in real time from a large number of servers, developed at Facebook.
|
10
10
|
|
11
|
-
It uses Thrift[http://thrift.apache.org/], cross-language RPC framework, to communicate between clients and servers.
|
11
|
+
It uses Thrift[http://thrift.apache.org/], a cross-language RPC framework, to communicate between clients and servers.
|
12
12
|
|
13
13
|
== What's Scribe plugin for fluent?
|
14
14
|
|
15
|
-
The Scribe plugin for
|
15
|
+
The Scribe plugin for fluentd, which enables fluentd to talk the Scribe protocol. Scribe protocol is defined as follows, in Thrift-IDL format:
|
16
16
|
|
17
17
|
enum ResultCode
|
18
18
|
{
|
@@ -31,11 +31,11 @@ The Scribe plugin for fluent enables fluent daemon, to talk the Scribe protocol
|
|
31
31
|
ResultCode Log(1: list<LogEntry> messages);
|
32
32
|
}
|
33
33
|
|
34
|
-
The category field is used as
|
34
|
+
The category field is used as fluentd 'tag'.
|
35
35
|
|
36
36
|
== How to use?
|
37
37
|
|
38
|
-
|
38
|
+
Please add the following configurations to fluent.conf.
|
39
39
|
|
40
40
|
# Scribe input
|
41
41
|
<source>
|
@@ -43,12 +43,12 @@ To use this plugin with fluent, please add the following configuration to fluent
|
|
43
43
|
port 1463
|
44
44
|
</source>
|
45
45
|
|
46
|
-
|
46
|
+
These options are supported.
|
47
47
|
|
48
48
|
* port: port number (default: 1463)
|
49
49
|
* bind: bind address (default: 0.0.0.0)
|
50
50
|
* server_type: server architecture either in 'simple', 'threaded', 'thread_pool', 'nonblocking' (default: nonblocking)
|
51
|
-
*
|
51
|
+
* is_framed: use framed protocol or not (default: true)
|
52
52
|
|
53
53
|
== For Developers
|
54
54
|
|
@@ -64,6 +64,7 @@ Then please execute the sample client.
|
|
64
64
|
== Contributors
|
65
65
|
|
66
66
|
* {Satoshi Tagomori}[https://github.com/tagomoris]
|
67
|
+
* {Sadayuki Furuhashi}[https://github.com/frsyuki]
|
67
68
|
|
68
69
|
== Copyright
|
69
70
|
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.1
|
@@ -21,6 +21,12 @@ module Fluent
|
|
21
21
|
class ScribeInput < Input
|
22
22
|
Plugin.register_input('scribe', self)
|
23
23
|
|
24
|
+
config_param :port, :integer, :default => 1463
|
25
|
+
config_param :bind, :string, :default => '0.0.0.0'
|
26
|
+
config_param :server_type, :string, :default => 'nonblocking'
|
27
|
+
config_param :is_framed, :bool, :default => true
|
28
|
+
config_param :body_size_limit, :size, :default => 32*1024*1024 # TODO default
|
29
|
+
|
24
30
|
def initialize
|
25
31
|
require 'thrift'
|
26
32
|
$:.unshift File.join(File.dirname(__FILE__), 'thrift')
|
@@ -30,23 +36,11 @@ class ScribeInput < Input
|
|
30
36
|
require 'scribe_types'
|
31
37
|
require 'scribe_constants'
|
32
38
|
require 'scribe'
|
33
|
-
|
34
|
-
@port = 1463
|
35
|
-
@bind = '0.0.0.0'
|
36
|
-
@body_size_limit = 32*1024*1024 # TODO default
|
39
|
+
super
|
37
40
|
end
|
38
41
|
|
39
42
|
def configure(conf)
|
40
|
-
|
41
|
-
@port = @port.to_i
|
42
|
-
@bind = conf['bind'] || @bind
|
43
|
-
|
44
|
-
@server_type = conf['server_type'] || 'nonblocking'
|
45
|
-
@is_framed = conf['framed'].to_s != "false"
|
46
|
-
|
47
|
-
if body_size_limit = conf['body_size_limit']
|
48
|
-
@body_size_limit = Config.size_value(body_size_limit)
|
49
|
-
end
|
43
|
+
super
|
50
44
|
end
|
51
45
|
|
52
46
|
def start
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'fluent/test'
|
3
|
+
require 'lib/fluent/plugin/in_scribe'
|
4
|
+
|
5
|
+
class ScribeInputTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
Fluent::Test.setup
|
8
|
+
end
|
9
|
+
|
10
|
+
CONFIG = %[
|
11
|
+
port 14630
|
12
|
+
bind 127.0.0.1
|
13
|
+
]
|
14
|
+
|
15
|
+
def create_driver(conf=CONFIG)
|
16
|
+
Fluent::Test::InputTestDriver.new(Fluent::ScribeInput).configure(conf)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_configure
|
20
|
+
d = create_driver
|
21
|
+
assert_equal 14630, d.instance.port
|
22
|
+
assert_equal '127.0.0.1', d.instance.bind
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_time
|
26
|
+
d = create_driver
|
27
|
+
|
28
|
+
time = Time.parse("2011-01-02 13:14:15 UTC").to_i
|
29
|
+
Fluent::Engine.now = time
|
30
|
+
|
31
|
+
d.expect_emit "tag1", time, {"message"=>'aiueo'}
|
32
|
+
d.expect_emit "tag2", time, {"message"=>'aiueo'}
|
33
|
+
|
34
|
+
d.run do
|
35
|
+
d.expected_emits.each { |tag, time, record|
|
36
|
+
res = send(tag, record['message'])
|
37
|
+
assert_equal ResultCode::OK, res
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def send(tag, msg)
|
43
|
+
socket = Thrift::Socket.new '127.0.0.1', 14630
|
44
|
+
transport = Thrift::FramedTransport.new socket
|
45
|
+
protocol = Thrift::BinaryProtocol.new transport, false, false
|
46
|
+
client = Scribe::Client.new protocol
|
47
|
+
transport.open
|
48
|
+
raw_sock = socket.to_io
|
49
|
+
raw_sock.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1
|
50
|
+
entry = LogEntry.new
|
51
|
+
entry.category = tag
|
52
|
+
entry.message = msg.to_s
|
53
|
+
res = client.Log([entry])
|
54
|
+
transport.close
|
55
|
+
res
|
56
|
+
end
|
57
|
+
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.10.
|
4
|
+
version: 0.10.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fluentd
|
17
|
-
requirement: &
|
17
|
+
requirement: &2156672800 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.10.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2156672800
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: thrift
|
28
|
-
requirement: &
|
28
|
+
requirement: &2156671600 !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: *2156671600
|
37
37
|
description:
|
38
38
|
email:
|
39
39
|
executables: []
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/fluent/plugin/thrift/scribe.thrift
|
58
58
|
- lib/fluent/plugin/thrift/scribe_constants.rb
|
59
59
|
- lib/fluent/plugin/thrift/scribe_types.rb
|
60
|
+
- test/plugin/in_scribe.rb
|
60
61
|
- README.rdoc
|
61
62
|
has_rdoc: true
|
62
63
|
homepage: https://github.com/fluent/fluent-plugin-scribe
|
@@ -83,4 +84,5 @@ rubygems_version: 1.6.2
|
|
83
84
|
signing_key:
|
84
85
|
specification_version: 3
|
85
86
|
summary: Scribe plugin for Fluent event collector
|
86
|
-
test_files:
|
87
|
+
test_files:
|
88
|
+
- test/plugin/in_scribe.rb
|