fluent-plugin-scribe 0.10.6 → 0.10.7
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/VERSION +1 -1
- data/fluent-plugin-scribe.gemspec +2 -2
- data/lib/fluent/plugin/out_scribe.rb +20 -8
- data/test/plugin/out_scribe.rb +25 -0
- metadata +6 -6
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.7
|
@@ -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.10.
|
8
|
+
s.version = "0.10.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Kazuki Ohta}]
|
12
|
-
s.date = %q{2012-
|
12
|
+
s.date = %q{2012-02-04}
|
13
13
|
s.email = %q{kazuki.ohta@gmail.com}
|
14
14
|
s.executables = [%q{fluent-scribe-remote}]
|
15
15
|
s.extra_rdoc_files = [
|
@@ -26,6 +26,7 @@ class ScribeOutput < BufferedOutput
|
|
26
26
|
config_param :timeout, :integer, :default => 30
|
27
27
|
|
28
28
|
config_param :remove_prefix, :string, :default => nil
|
29
|
+
config_param :add_newline, :bool, :default => false
|
29
30
|
config_param :default_category, :string, :default => 'unknown'
|
30
31
|
|
31
32
|
def initialize
|
@@ -81,14 +82,25 @@ class ScribeOutput < BufferedOutput
|
|
81
82
|
transport.open
|
82
83
|
begin
|
83
84
|
entries = []
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
if @add_newline
|
86
|
+
records.each { |r|
|
87
|
+
tag, record = r
|
88
|
+
next unless record.has_key?(@field_ref)
|
89
|
+
entry = LogEntry.new
|
90
|
+
entry.category = tag
|
91
|
+
entry.message = (record[@field_ref] + "\n").force_encoding('ASCII-8BIT')
|
92
|
+
entries << entry
|
93
|
+
}
|
94
|
+
else
|
95
|
+
records.each { |r|
|
96
|
+
tag, record = r
|
97
|
+
next unless record.has_key?(@field_ref)
|
98
|
+
entry = LogEntry.new
|
99
|
+
entry.category = tag
|
100
|
+
entry.message = record[@field_ref].force_encoding('ASCII-8BIT')
|
101
|
+
entries << entry
|
102
|
+
}
|
103
|
+
end
|
92
104
|
client.Log(entries)
|
93
105
|
ensure
|
94
106
|
transport.close
|
data/test/plugin/out_scribe.rb
CHANGED
@@ -69,6 +69,19 @@ remove_prefix test
|
|
69
69
|
d.emit({"message" => "xxx testing first", "message2" => "xxx testing first another data"}, time)
|
70
70
|
d.expect_format ['unknown', {"message" => "xxx testing first", "message2" => "xxx testing first another data"}].to_msgpack
|
71
71
|
d.run
|
72
|
+
|
73
|
+
d = create_driver(CONFIG + %[
|
74
|
+
field_ref message2
|
75
|
+
remove_prefix test
|
76
|
+
add_newline true
|
77
|
+
], 'test.scribeplugin')
|
78
|
+
assert_equal 'test.scribeplugin', d.tag
|
79
|
+
|
80
|
+
d.emit({"message" => "xxx testing first", "message2" => "xxx testing first another data"}, time)
|
81
|
+
d.emit({"message" => "xxx testing second", "message2" => "xxx testing second another data"}, time)
|
82
|
+
d.expect_format ['scribeplugin', {"message" => "xxx testing first", "message2" => "xxx testing first another data"}].to_msgpack
|
83
|
+
d.expect_format ['scribeplugin', {"message" => "xxx testing second", "message2" => "xxx testing second another data"}].to_msgpack
|
84
|
+
d.run
|
72
85
|
end
|
73
86
|
|
74
87
|
def test_write
|
@@ -95,6 +108,18 @@ remove_prefix test
|
|
95
108
|
|
96
109
|
d = create_driver(CONFIG + %[
|
97
110
|
field_ref message2
|
111
|
+
remove_prefix test
|
112
|
+
add_newline true
|
113
|
+
], 'test.scribeplugin')
|
114
|
+
assert_equal 'test.scribeplugin', d.tag
|
115
|
+
d.emit({"message" => "xxx testing first", "message2" => "xxx testing first another data"}, time)
|
116
|
+
d.emit({"message" => "xxx testing second", "message2" => "xxx testing second another data"}, time)
|
117
|
+
result = d.run
|
118
|
+
assert_equal ResultCode::OK, result
|
119
|
+
assert_equal [['scribeplugin', "xxx testing first another data\n"], ['scribeplugin', "xxx testing second another data\n"]], $handler.last
|
120
|
+
|
121
|
+
d = create_driver(CONFIG + %[
|
122
|
+
field_ref message2
|
98
123
|
remove_prefix test
|
99
124
|
], 'xxx.test.scribeplugin')
|
100
125
|
assert_equal 'xxx.test.scribeplugin', d.tag
|
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.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-02-04 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156552400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.10.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156552400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thrift
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156551600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.8.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156551600
|
36
36
|
description:
|
37
37
|
email: kazuki.ohta@gmail.com
|
38
38
|
executables:
|