logstash-codec-fluent 3.1.5-java → 3.2.0-java
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/LICENSE +1 -1
- data/lib/logstash/codecs/fluent.rb +15 -1
- data/logstash-codec-fluent.gemspec +1 -1
- data/spec/codecs/fluent_spec.rb +38 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee03e06bd2f0fc38268db7f16e6de3405328331f63e08007feb24a91bd4cef34
|
4
|
+
data.tar.gz: 2413c637ab79150cc9dc6731f6cefd36969909487ac217d145d7f1298ba28250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9932e23fdfe7efd1896fa45be2b86c630a8150ad2d823f7b6ab980ce458045db9e019580dcf33b14565d3411efea0b5b1c88d0c5e8a7fbffc7bb622f8a85b70b
|
7
|
+
data.tar.gz: 3ee22d094f5be07cb97310a94d9de06127377d757770d0899ae0ff11ad0f45969ac4fde29b1866e964691a24bd228c61a62b945114b0ae59819ee1ae9b17f47d
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
@@ -40,7 +40,9 @@ class LogStash::Codecs::Fluent < LogStash::Codecs::Base
|
|
40
40
|
end # def decode
|
41
41
|
|
42
42
|
def encode(event)
|
43
|
-
tag
|
43
|
+
# Ensure tag to "tag1.tag2.tag3" style string.
|
44
|
+
# Fluentd cannot handle Array class value in forward protocol's tag.
|
45
|
+
tag = forwardable_tag(event)
|
44
46
|
epochtime = event.timestamp.to_i
|
45
47
|
|
46
48
|
# use normalize to make sure returned Hash is pure Ruby for
|
@@ -51,6 +53,18 @@ class LogStash::Codecs::Fluent < LogStash::Codecs::Base
|
|
51
53
|
@on_event.call(event, MessagePack.pack([tag, epochtime, data.merge(LogStash::Event::TIMESTAMP => event.timestamp.to_iso8601)]))
|
52
54
|
end # def encode
|
53
55
|
|
56
|
+
def forwardable_tag(event)
|
57
|
+
tag = event.get("tags") || "log"
|
58
|
+
case tag
|
59
|
+
when Array
|
60
|
+
tag.join('.')
|
61
|
+
when String
|
62
|
+
tag
|
63
|
+
else
|
64
|
+
tag.to_s
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
54
68
|
private
|
55
69
|
|
56
70
|
def decode_event(data, &block)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-codec-fluent'
|
4
|
-
s.version = '3.
|
4
|
+
s.version = '3.2.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Reads the `fluentd` `msgpack` schema"
|
7
7
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
data/spec/codecs/fluent_spec.rb
CHANGED
@@ -43,6 +43,44 @@ describe LogStash::Codecs::Fluent do
|
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
|
+
describe "forward protocol tag" do
|
47
|
+
let(:event) { LogStash::Event.new(properties) }
|
48
|
+
subject { LogStash::Plugin.lookup("codec", "fluent").new }
|
49
|
+
|
50
|
+
describe "when passing Array value" do
|
51
|
+
let(:properties) { {:tags => ["test", "logstash"], :name => "foo" } }
|
52
|
+
|
53
|
+
|
54
|
+
it "should be joined with '.'" do
|
55
|
+
subject.forwardable_tag(event) do |tag|
|
56
|
+
expect(tag).to eq("test.logstash")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "when passing String value" do
|
62
|
+
let(:properties) { {:tags => "test.logstash", :name => "foo" } }
|
63
|
+
|
64
|
+
|
65
|
+
it "should be pass-through" do
|
66
|
+
subject.forwardable_tag(event) do |tag|
|
67
|
+
expect(tag).to eq("test.logstash")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "when passing other value" do
|
73
|
+
let(:properties) { {:tags => :symbol, :name => "foo" } }
|
74
|
+
|
75
|
+
it "should be called to_s" do
|
76
|
+
subject.forwardable_tag(event) do |tag|
|
77
|
+
expect(tag).to eq("symbol")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
46
84
|
describe "event decoding (buckets of events)" do
|
47
85
|
|
48
86
|
let(:tag) { "mytag" }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-codec-fluent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.6.
|
102
|
+
rubygems_version: 2.6.13
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Reads the `fluentd` `msgpack` schema
|