fluent-plugin-add 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49141f6cd44530842d01c39e8eb505545bfe6101
4
- data.tar.gz: 42fb92447f760354d70c5be91c4a5c3327d67993
3
+ metadata.gz: cadcc4d9fff5a6fd452df91548840dc0a5958bea
4
+ data.tar.gz: 7d828143d5f3b13d567d1dcad645f450fdf44c50
5
5
  SHA512:
6
- metadata.gz: b293e25253519f1df15b06b20ea3a27cdb76b3674ee1ee6053bd939579f3f9f99dea5b1f47f55fd307dc33ad982879f28f8e74aa3003dc7d7a04f87582de92b5
7
- data.tar.gz: e0431ed2690e42a0e2945349f8131c1c5f4d093a7538aac2c6359f15a7f4e8da972c6fa493acfc788df2d83958affc80caf443d73c6a25a69aca0c600ac4116b
6
+ metadata.gz: dfd5aeba2d5d78d7924df5af3b4c260e83850aaec80701768fb17e1ad50539e2ae334aa597a624c2146045df57d4c01c639ccf61ca65dd353d33589f64187c02
7
+ data.tar.gz: 0b6a98f8564de1bb611ad93b55212a9e6ee2a669697c2720ac651d391eaddc9f7b8b714d1e3fcae94605649c4c591d77586c64d998c6fc28cb55dcd5d4125b59
@@ -1,11 +1,10 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
+ - 2.4.0
4
5
  - 2.3.0
5
6
  - 2.2
6
7
  - 2.1
7
- - 2.0.0
8
- - 1.9.3
9
8
  bundler_args: --jobs=2
10
9
  script: rake test
11
10
  branches:
data/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  ### AddOutput
14
14
 
15
15
  <match test.**>
16
- type add
16
+ @type add
17
17
  add_tag_prefix debug
18
18
  uuid true # optional
19
19
  <pair>
@@ -31,8 +31,8 @@
31
31
  ### AddFilter
32
32
 
33
33
  <filter test.**>
34
- type add
35
- uuid true # optional
34
+ @type add
35
+ uuid true # optional
36
36
  <pair>
37
37
  hoge moge
38
38
  hogehoge mogemoge
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "fluent-plugin-add"
8
- spec.version = "0.0.6"
8
+ spec.version = "0.0.7"
9
9
  spec.authors = ["yu yamada"]
10
10
  spec.email = ["yu.yamada07@gmail.com"]
11
11
  spec.description = %q{Output filter plugin to add messages}
@@ -4,6 +4,8 @@ class Fluent::AddFilter < Fluent::Filter
4
4
  Fluent::Plugin.register_filter('add', self)
5
5
 
6
6
  config_param :uuid, :bool, :default => false
7
+ config_param :uuid_key, :string, :default => 'uuid'
8
+
7
9
  def initialize
8
10
  super
9
11
  end
@@ -28,7 +30,7 @@ class Fluent::AddFilter < Fluent::Filter
28
30
  record[k] = v
29
31
  end
30
32
  if @uuid
31
- record['uuid'] = SecureRandom.uuid.upcase
33
+ record[@uuid_key] = SecureRandom.uuid.upcase
32
34
  end
33
35
  record
34
36
  end
@@ -10,6 +10,7 @@ class Fluent::AddOutput < Fluent::Output
10
10
 
11
11
  config_param :add_tag_prefix, :string, :default => 'greped'
12
12
  config_param :uuid, :bool, :default => false
13
+ config_param :uuid_key, :string, :default => 'uuid'
13
14
 
14
15
  def initialize
15
16
  super
@@ -45,7 +46,7 @@ class Fluent::AddOutput < Fluent::Output
45
46
  record[k] = v
46
47
  end
47
48
  if @uuid
48
- record['uuid'] = SecureRandom.uuid.upcase
49
+ record[@uuid_key] = SecureRandom.uuid.upcase
49
50
  end
50
51
  router.emit(emit_tag, time, record)
51
52
  end
@@ -49,6 +49,16 @@ class AddFilterTest < Test::Unit::TestCase
49
49
  end
50
50
  assert d.filtered_as_array[0][2].has_key?('uuid')
51
51
 
52
+ d.run
53
+ end
54
+ def test_uuid_key
55
+ d = create_driver("#{CONFIG_UU}\nuuid_key test_uuid")
56
+
57
+ d.run do
58
+ d.emit("a" => 1)
59
+ end
60
+ assert d.filtered_as_array[0][2].has_key?('test_uuid')
61
+
52
62
  d.run
53
63
  end
54
64
  end
@@ -53,6 +53,16 @@ class AddOutputTest < Test::Unit::TestCase
53
53
  end
54
54
  assert d.records[0].has_key?('uuid')
55
55
 
56
+ d.run
57
+ end
58
+ def test_uuid_key
59
+ d = create_driver("#{CONFIG_UU}\nuuid_key test_uuid")
60
+
61
+ d.run do
62
+ d.emit("a" => 1)
63
+ end
64
+ assert d.records[0].has_key?('test_uuid')
65
+
56
66
  d.run
57
67
  end
58
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-add
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - yu yamada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-02 00:00:00.000000000 Z
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler