fluent-plugin-forest 0.2.3 → 0.2.4

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: ea721095d308823baadbc9e6296c076c75d1011f
4
- data.tar.gz: d5d3ae86ae4638783e7f8286373c1b47906068b9
3
+ metadata.gz: a3258fc645b387ab5f9dbd03981fff601d5ee66a
4
+ data.tar.gz: 1254f5e53ce7d0ecb7195033c459f3a02c7d1976
5
5
  SHA512:
6
- metadata.gz: a0ce28f5b60185e4758367ef918990cf18537e8a5b5bcaa308b7d554efd4ff810c0bda0825262fd11510abdbaced8c39ff85566b8cc51d21df88b849db759d65
7
- data.tar.gz: 061c8287095c952c4fc94be45bc24e755f86dc067c1130fc34b1ab1a4830bb7d4cf9bdab1a6ee48522c6b18ca498495c53bad71f8df0227619a0e1f4a28181f5
6
+ metadata.gz: d4a445761e331b96e551a18c18937bfef3dff23ea71d9510d3f4e40be851b66364ed8eb63acc7a76d59d007f639023eb459cc01696bc8f8af237d6ce2f9e3e1a
7
+ data.tar.gz: f038b8287ff57a31ff260af1de9e8449e5659042719d81242551de828889d07a26497526521c3aa277b4ebe7ac66ca5d6d710c43d33154e790938f6f93070708
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # fluent-plugin-forest
2
2
 
3
+ This is a plugin for [Fluentd](http://fluentd.org).
4
+
3
5
  ## Component
4
6
 
5
7
  ### ForestOutput
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-plugin-forest"
4
- gem.version = "0.2.3"
4
+ gem.version = "0.2.4"
5
5
  gem.authors = ["TAGOMORI Satoshi"]
6
6
  gem.email = ["tagomoris@gmail.com"]
7
7
  gem.description = %q{create sub-plugin dynamically per tags, with template configuration and parameters}
@@ -9,6 +9,11 @@ class Fluent::ForestOutput < Fluent::MultiOutput
9
9
 
10
10
  attr_reader :outputs
11
11
 
12
+ # Define `log` method for v0.10.42 or earlier
13
+ unless method_defined?(:log)
14
+ define_method("log") { $log }
15
+ end
16
+
12
17
  def configure(conf)
13
18
  super
14
19
 
@@ -67,23 +72,23 @@ class Fluent::ForestOutput < Fluent::MultiOutput
67
72
  e.each do |k,v|
68
73
  v = v.gsub(/__TAG_PARTS\[-?[0-9]+(?:\.\.\.?-?[0-9]+)?\]__|\$\{tag_parts\[-?[0-9]+(?:\.\.\.?-?[0-9]+)?\]\}/) do |tag_parts_matched|
69
74
  matched = /\[(?<first>-?[0-9]+)(?<range_part>(?<range_type>\.\.\.?)(?<last>-?[0-9]+))?\]/.match(tag_parts_matched)
70
- if matched && matched[:range_part]
75
+ raise "BUG: gsub regex matches but index regex does not match" unless matched
76
+
77
+ if matched[:range_part]
71
78
  exclude_end = (matched[:range_type] == '...')
72
79
  range = Range.new(matched[:first].to_i, matched[:last].to_i, exclude_end)
73
80
  if tag_parts[range]
74
81
  tag_parts[range].join(".")
75
82
  else
76
- $log.warn "out_forest: missing placeholder. tag:#{tag} placeholder:#{tag_parts_matched} conf:#{k} #{v}"
83
+ log.warn "out_forest: missing placeholder. tag:#{tag} placeholder:#{tag_parts_matched} conf:#{k} #{v}"
77
84
  nil
78
85
  end
79
- elsif matched # non range index (without range_part)
86
+ else # non range index (without range_part)
80
87
  index = matched[:first].to_i
81
88
  unless tag_parts[index]
82
- $log.warn "out_forest: missing placeholder. tag:#{tag} placeholder:#{tag_parts_matched} conf:#{k} #{v}"
89
+ log.warn "out_forest: missing placeholder. tag:#{tag} placeholder:#{tag_parts_matched} conf:#{k} #{v}"
83
90
  end
84
91
  tag_parts[index]
85
- else
86
- raise "BUG: gsub regex matches but index regex does not match"
87
92
  end
88
93
  end
89
94
  v = v.gsub('__ESCAPED_TAG__', escaped_tag).gsub('${escaped_tag}', escaped_tag)
@@ -130,16 +135,16 @@ class Fluent::ForestOutput < Fluent::MultiOutput
130
135
  @outputs.push(output)
131
136
  end
132
137
  }
133
- $log.info "out_forest plants new output: #{@subtype} for tag '#{tag}'"
138
+ log.info "out_forest plants new output: #{@subtype} for tag '#{tag}'"
134
139
  rescue Fluent::ConfigError => e
135
- $log.error "failed to configure sub output #{@subtype}: #{e.message}"
136
- $log.error e.backtrace.join("\n")
137
- $log.error "Cannot output messages with tag '#{tag}'"
140
+ log.error "failed to configure sub output #{@subtype}: #{e.message}"
141
+ log.error e.backtrace.join("\n")
142
+ log.error "Cannot output messages with tag '#{tag}'"
138
143
  output = nil
139
144
  rescue StandardError => e
140
- $log.error "failed to configure/start sub output #{@subtype}: #{e.message}"
141
- $log.error e.backtrace.join("\n")
142
- $log.error "Cannot output messages with tag '#{tag}'"
145
+ log.error "failed to configure/start sub output #{@subtype}: #{e.message}"
146
+ log.error e.backtrace.join("\n")
147
+ log.error "Cannot output messages with tag '#{tag}'"
143
148
  output = nil
144
149
  end
145
150
  output
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-forest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-30 00:00:00.000000000 Z
11
+ date: 2014-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fluentd
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: create sub-plugin dynamically per tags, with template configuration and
@@ -46,8 +46,8 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - .gitignore
50
- - .travis.yml
49
+ - ".gitignore"
50
+ - ".travis.yml"
51
51
  - Gemfile
52
52
  - LICENSE.txt
53
53
  - README.md
@@ -68,17 +68,17 @@ require_paths:
68
68
  - lib
69
69
  required_ruby_version: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - '>='
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.0.3
81
+ rubygems_version: 2.2.2
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: plugin to create output plugin instances per tags dynamically
@@ -87,4 +87,3 @@ test_files:
87
87
  - test/output/out_forest_test.rb
88
88
  - test/plugin/test_out_forest.rb
89
89
  - test/plugin/test_out_forest_test.rb
90
- has_rdoc: