fluent-plugin-path2tag 1.0.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae392e5bb11da4f51e7b6009341ad9212a6e1dda
4
- data.tar.gz: b5d9ffd349a0f27c42d3cc6d7718d219d0c288de
3
+ metadata.gz: a962ab26aa24ec0b5d52fd974d270ab4a31d5b75
4
+ data.tar.gz: ac7c9ffd2c91de379bfc54f1dd3eacf2f40fb24b
5
5
  SHA512:
6
- metadata.gz: 9e19a37f51ab1d925e6bb09d2149e98c60abe750e56ab52638d2a9b5d4de2cd0cfa5f6e3d5031f98859bbbe22e001b8028d0e6a5bfbeccf5ad5c15bc28627fe8
7
- data.tar.gz: 967be47a6ab16b03746463b28820d6d8582ed7581acf70161c071555cfe9e157477ed05ea6d60a8a96828754aa1252b6d81a08b3e525480382fd1083bb2c89fe
6
+ metadata.gz: 8956663b1d886c1a9fb6a500d5c133f6b5b3dac0aae25a9d049ab9565631fb84dbfcdf9570535696f90c668ccbc48fb27871348174eb61c636d486fdbcf0de08
7
+ data.tar.gz: 3c49c6bbaef94488c9fdfd7cab02caffb1393e2a17cb92ef8314862d7813c3b817d5f2b3b7f6cd29b5c5f6375cc3a99d889cecf4794143a0065b6cffd7c1d165
data/README.md CHANGED
@@ -37,10 +37,6 @@ path2tag <path_key_name> <data_key_name>
37
37
  @type path2tag
38
38
  path2tag request_uri request_body
39
39
  </match>
40
-
41
- <match path2tag.clear>
42
- @type null
43
- </match>
44
40
  ```
45
41
 
46
42
  ## License
@@ -32,7 +32,7 @@ class Fluent::Path2tagOutput < Fluent::Output
32
32
 
33
33
  log.info "[path2tag] change tag to #{rewrited_tag}"
34
34
 
35
- if newrecords.class == "Array"
35
+ if newrecords.kind_of?(Array)
36
36
  newrecords.each do |r|
37
37
  router.emit(rewrited_tag, time, r)
38
38
  end
@@ -1,7 +1,7 @@
1
1
  module Fluent
2
2
  module Plugin
3
3
  module Path2tag
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
6
6
  end
7
7
  end
@@ -50,7 +50,7 @@ class Path2tagTest < Test::Unit::TestCase
50
50
 
51
51
  def test_emit_ok
52
52
  d1 = create_driver(CONFIG_OK, 'nginx.access')
53
- body = '[{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}]'
53
+ body = '{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}'
54
54
  d1.run do
55
55
  d1.emit({'request_uri' => '/path/foo/bar', 'request_body' => body})
56
56
  end
@@ -62,7 +62,7 @@ class Path2tagTest < Test::Unit::TestCase
62
62
 
63
63
  def test_emit_no_path_key
64
64
  d1 = create_driver(CONFIG_NO_PATH_KEY, 'nginx.access')
65
- body = '[{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}]'
65
+ body = '{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}'
66
66
  d1.run do
67
67
  d1.emit({'request_uri' => '/path/foo/bar', 'request_body' => body})
68
68
  end
@@ -72,7 +72,7 @@ class Path2tagTest < Test::Unit::TestCase
72
72
 
73
73
  def test_emit_no_data_key
74
74
  d1 = create_driver(CONFIG_NO_DATA_KEY, 'nginx.access')
75
- body = '[{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}]'
75
+ body = '{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}'
76
76
  d1.run do
77
77
  d1.emit({'request_uri' => '/path/foo/bar', 'request_body' => body})
78
78
  end
@@ -82,7 +82,7 @@ class Path2tagTest < Test::Unit::TestCase
82
82
 
83
83
  def test_emit_path_format_1
84
84
  d1 = create_driver(CONFIG_OK, 'nginx.access')
85
- body = '[{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}]'
85
+ body = '{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}'
86
86
  d1.run do
87
87
  d1.emit({'request_uri' => '/path/foo/bar', 'request_body' => body})
88
88
  end
@@ -94,7 +94,7 @@ class Path2tagTest < Test::Unit::TestCase
94
94
 
95
95
  def test_emit_path_format_2
96
96
  d1 = create_driver(CONFIG_OK, 'nginx.access')
97
- body = '[{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}]'
97
+ body = '{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}'
98
98
  d1.run do
99
99
  d1.emit({'request_uri' => 'path/foo/bar', 'request_body' => body})
100
100
  end
@@ -106,7 +106,7 @@ class Path2tagTest < Test::Unit::TestCase
106
106
 
107
107
  def test_emit_path_format_3
108
108
  d1 = create_driver(CONFIG_OK, 'nginx.access')
109
- body = '[{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}]'
109
+ body = '{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}'
110
110
  d1.run do
111
111
  d1.emit({'request_uri' => '/path/foo/bar/', 'request_body' => body})
112
112
  end
@@ -118,7 +118,7 @@ class Path2tagTest < Test::Unit::TestCase
118
118
 
119
119
  def test_emit_path_format_4
120
120
  d1 = create_driver(CONFIG_OK, 'nginx.access')
121
- body = '[{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}]'
121
+ body = '{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}'
122
122
  d1.run do
123
123
  d1.emit({'request_uri' => 'path', 'request_body' => body})
124
124
  end
@@ -130,14 +130,14 @@ class Path2tagTest < Test::Unit::TestCase
130
130
 
131
131
  def test_emit_json_parse
132
132
  d1 = create_driver(CONFIG_OK, 'nginx.access')
133
- body = '{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}'
133
+ body = '[{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}]'
134
134
  d1.run do
135
135
  d1.emit({'request_uri' => 'path/foo/bar', 'request_body' => body})
136
136
  end
137
137
  emits = d1.emits
138
138
  assert_equal 1, emits.length
139
139
  assert_equal 'path.foo.bar', emits[0][0]
140
- assert_equal JSON.parse(body), emits[0][2]
140
+ assert_equal JSON.parse('{"fluentd_time":"2017-02-20 10:39:14 UTC","unique_id":"123ABC","device_token":"ABC123"}'), emits[0][2]
141
141
  end
142
142
 
143
143
  def test_emit_json_parse_2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-path2tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Kuwahara