fluentd 0.12.6 → 0.12.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c985cc764cdbd2bf187c6bc753ab848872903cb7
4
- data.tar.gz: 38415f2aee1237c4b47a42bd2b5b0dfa5badee39
3
+ metadata.gz: 34615d5421761b2b42cd9831d2d87a96ac401b9d
4
+ data.tar.gz: 49ba7a22424ee071c07c166e35a5bff49720327b
5
5
  SHA512:
6
- metadata.gz: 34944adc24897e3ef75b1abeecd0561ef75aa5d44db6f0d40f4aa248e9d0fb9b4610d7f00724e3b5f22a693ec55217c8288e01c5a7bfb204182f11cbf8bc181a
7
- data.tar.gz: 96a843e248cefc58c1246f65f5a316fc8ff7f8d05b7d0fe55a63f4b676674dccae49397c752b17dea4ec8aff5fd3be00247c562d40ab06cbf884318e21eea723
6
+ metadata.gz: d71f71d6e0f4267836f6f683698a9dbe12c5447dd95a19a1a251bde03e058913a6b32de0a7bdad98783efb198660cf5a5dfebe76ec5e60ebf19d698654ded6b6
7
+ data.tar.gz: 6a09feb33ef26f30c0901d3f0e2e6b046d4a837b1679c69b7c87abf12f2de2cd5ce3a88ff86a220c81ee5a0e0cd8fcb5aea9d9899aa6b757be24ee79d63df2a3
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ test/tmp/*
20
20
  test/config/tmp/*
21
21
  make_dist.sh
22
22
  Gemfile.local
23
+ .ruby-version
@@ -16,6 +16,7 @@ branches:
16
16
  only:
17
17
  - master
18
18
  - v0.10
19
+ - v0.14
19
20
 
20
21
  gemfile:
21
22
  - Gemfile
data/ChangeLog CHANGED
@@ -1,5 +1,15 @@
1
1
  # v0.12
2
2
 
3
+ ## Release 0.12.7 - 2015/03/22
4
+
5
+ ### New features / Enhancement
6
+
7
+ * in_tail: Add exclude_path option to support exclusion of files
8
+ https://github.com/fluent/fluentd/pull/561
9
+ * filter_record_transformer: Support placeholders in record keys
10
+ https://github.com/fluent/fluentd/pull/558
11
+
12
+
3
13
  ## Release 0.12.6 - 2015/03/03
4
14
 
5
15
  ### Bug fixes
@@ -108,27 +108,29 @@ module Fluent
108
108
 
109
109
  new_record = @renew_record ? {} : record.dup
110
110
  @keep_keys.each {|k| new_record[k] = record[k]} if @keep_keys and @renew_record
111
- @map.each_pair {|k, v| new_record[k] = interpolate(v)}
111
+ new_record.merge!(expand_placeholders(@map))
112
112
  @remove_keys.each {|k| new_record.delete(k) } if @remove_keys
113
113
 
114
114
  new_record
115
115
  end
116
116
 
117
- def interpolate(value)
117
+ def expand_placeholders(value)
118
118
  if value.is_a?(String)
119
- value = @placeholder_expander.expand(value)
119
+ new_value = @placeholder_expander.expand(value)
120
120
  elsif value.is_a?(Hash)
121
121
  new_value = {}
122
122
  value.each_pair do |k, v|
123
- new_value[@placeholder_expander.expand(k)] = interpolate(v)
123
+ new_value[@placeholder_expander.expand(k)] = expand_placeholders(v)
124
124
  end
125
- value = new_value
126
125
  elsif value.is_a?(Array)
126
+ new_value = []
127
127
  value.each_with_index do |v, i|
128
- value[i] = interpolate(v)
128
+ new_value[i] = expand_placeholders(v)
129
129
  end
130
+ else
131
+ new_value = value
130
132
  end
131
- value
133
+ new_value
132
134
  end
133
135
 
134
136
  def tag_prefix(tag_parts)
@@ -26,6 +26,7 @@ module Fluent
26
26
 
27
27
  config_param :path, :string
28
28
  config_param :tag, :string
29
+ config_param :exclude_path, :array, :default => []
29
30
  config_param :rotate_wait, :time, :default => 5
30
31
  config_param :pos_file, :string, :default => nil
31
32
  config_param :read_from_head, :bool, :default => false
@@ -99,6 +100,8 @@ module Fluent
99
100
  def expand_paths
100
101
  date = Time.now
101
102
  paths = []
103
+
104
+ excluded = @exclude_path.map { |path| path = date.strftime(path); path.include?('*') ? Dir.glob(path) : path }.flatten.uniq
102
105
  @paths.each { |path|
103
106
  path = date.strftime(path)
104
107
  if path.include?('*')
@@ -108,7 +111,7 @@ module Fluent
108
111
  paths << path
109
112
  end
110
113
  }
111
- paths
114
+ paths - excluded
112
115
  end
113
116
 
114
117
  # in_tail with '*' path doesn't check rotation file equality at refresh phase.
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '0.12.6'
19
+ VERSION = '0.12.7'
20
20
 
21
21
  end
@@ -271,6 +271,7 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
271
271
  assert_equal({"hostname" => @hostname, "tag" => @tag, "#{@tag}" => 100}, r['hash_field'])
272
272
  end
273
273
  end
274
+
274
275
  test "array values with placeholders with enable_ruby #{enable_ruby}" do
275
276
  config = %[
276
277
  enable_ruby #{enable_ruby}
@@ -284,6 +285,7 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
284
285
  assert_equal([@hostname, @tag], r['array_field'])
285
286
  end
286
287
  end
288
+
287
289
  test "array and hash values with placeholders with enable_ruby #{enable_ruby}" do
288
290
  config = %[
289
291
  enable_ruby #{enable_ruby}
@@ -297,6 +299,22 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
297
299
  assert_equal([{"tag" => @tag}], r['mixed_field'])
298
300
  end
299
301
  end
302
+
303
+ test "keys with placeholders with enable_ruby #{enable_ruby}" do
304
+ config = %[
305
+ enable_ruby #{enable_ruby}
306
+ renew_record true
307
+ <record>
308
+ ${hostname} hostname
309
+ foo.${tag} tag
310
+ </record>
311
+ ]
312
+ msgs = ['1', '2']
313
+ es = emit(config, msgs)
314
+ es.each_with_index do |(t, r), i|
315
+ assert_equal({@hostname=>'hostname',"foo.#{@tag}"=>'tag'}, r)
316
+ end
317
+ end
300
318
  end
301
319
 
302
320
  test 'unknown placeholder (enable_ruby no)' do
@@ -389,6 +389,11 @@ class TailInputTest < Test::Unit::TestCase
389
389
  timeclass.should_receive(:now).with_no_args.and_return(Time.new(2010, 1, 2, 3, 4, 5))
390
390
  assert_equal EX_PATHS, plugin.expand_paths.sort
391
391
  end
392
+
393
+ # Test exclusion
394
+ exclude_config = EX_CONFIG + " exclude_path [\"#{EX_PATHS.last}\"]"
395
+ plugin = create_driver(exclude_config, false).instance
396
+ assert_equal EX_PATHS - [EX_PATHS.last], plugin.expand_paths.sort
392
397
  end
393
398
 
394
399
  def test_refresh_watchers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.6
4
+ version: 0.12.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack