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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3aca8f819ccd68370aca89aaa41b3181b410dad316d242a3d07e06d44e4f7808
4
- data.tar.gz: 79a5070f79985cd4cbdd4b64d9d1215c8567deb7476b9816b7a8ed618d66a821
3
+ metadata.gz: ee03e06bd2f0fc38268db7f16e6de3405328331f63e08007feb24a91bd4cef34
4
+ data.tar.gz: 2413c637ab79150cc9dc6731f6cefd36969909487ac217d145d7f1298ba28250
5
5
  SHA512:
6
- metadata.gz: 3a292af9e0c446a9b0f2b452a72ac26631ba54c25a5ce3ecf5e8df75b51e7e0a0ac477791118391312a987dff55caeeb8eb5d69a12f57e2be2345a91d4f8d16f
7
- data.tar.gz: bab9368b368a34068c3638abbc1e6a81389f99d52112dfdd0986cf973fb94593a447e65ab9c32dd1efb301ab03d11a704585333801c4a3968c36e964010ac289
6
+ metadata.gz: 9932e23fdfe7efd1896fa45be2b86c630a8150ad2d823f7b6ab980ce458045db9e019580dcf33b14565d3411efea0b5b1c88d0c5e8a7fbffc7bb622f8a85b70b
7
+ data.tar.gz: 3ee22d094f5be07cb97310a94d9de06127377d757770d0899ae0ff11ad0f45969ac4fde29b1866e964691a24bd228c61a62b945114b0ae59819ee1ae9b17f47d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.2.0
2
+ - Encode tags as fluent forward protocol tags. Ref: https://github.com/logstash-plugins/logstash-codec-fluent/pull/21
3
+
1
4
  ## 3.1.5
2
5
  - Update gemspec summary
3
6
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co>
1
+ Copyright (c) 2012-2018 Elasticsearch <http://www.elastic.co>
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -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 = event.get("tags") || "log"
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.1.5'
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"
@@ -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.1.5
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: 2017-11-07 00:00:00.000000000 Z
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.11
102
+ rubygems_version: 2.6.13
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Reads the `fluentd` `msgpack` schema