fluent-plugin-record-reformer 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/fluent-plugin-record-reformer.gemspec +1 -1
- data/lib/fluent/plugin/out_record_reformer.rb +12 -4
- data/spec/out_record_reformer_spec.rb +17 -0
- metadata +4 -4
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "fluent-plugin-record-reformer"
|
6
|
-
gem.version = "0.2.
|
6
|
+
gem.version = "0.2.7"
|
7
7
|
gem.authors = ["Naotoshi Seo"]
|
8
8
|
gem.email = "sonots@gmail.com"
|
9
9
|
gem.homepage = "https://github.com/sonots/fluent-plugin-record-reformer"
|
@@ -48,9 +48,9 @@ module Fluent
|
|
48
48
|
require 'pathname'
|
49
49
|
require 'uri'
|
50
50
|
require 'cgi'
|
51
|
-
RubyPlaceholderExpander.new
|
51
|
+
RubyPlaceholderExpander.new(log)
|
52
52
|
else
|
53
|
-
PlaceholderExpander.new
|
53
|
+
PlaceholderExpander.new(log)
|
54
54
|
end
|
55
55
|
|
56
56
|
@hostname = Socket.gethostname
|
@@ -113,7 +113,11 @@ module Fluent
|
|
113
113
|
end
|
114
114
|
|
115
115
|
class PlaceholderExpander
|
116
|
-
attr_reader :placeholders
|
116
|
+
attr_reader :placeholders, :log
|
117
|
+
|
118
|
+
def initialize(log)
|
119
|
+
@log = log
|
120
|
+
end
|
117
121
|
|
118
122
|
def prepare_placeholders(time, record, opts)
|
119
123
|
placeholders = { '${time}' => Time.at(time).to_s }
|
@@ -143,7 +147,11 @@ module Fluent
|
|
143
147
|
end
|
144
148
|
|
145
149
|
class RubyPlaceholderExpander
|
146
|
-
attr_reader :placeholders
|
150
|
+
attr_reader :placeholders, :log
|
151
|
+
|
152
|
+
def initialize(log)
|
153
|
+
@log = log
|
154
|
+
end
|
147
155
|
|
148
156
|
# Get placeholders as a struct
|
149
157
|
#
|
@@ -177,6 +177,23 @@ describe Fluent::RecordReformerOutput do
|
|
177
177
|
it { emit }
|
178
178
|
end
|
179
179
|
|
180
|
+
context 'enable_ruby no (unknown placeholder)' do
|
181
|
+
let(:emit) do
|
182
|
+
driver.run { driver.emit({'foo'=>'bar', 'message' => '1'}, time.to_i) }
|
183
|
+
end
|
184
|
+
let(:config) {%[
|
185
|
+
type reformed
|
186
|
+
output_tag reformed.${tag}
|
187
|
+
enable_ruby no
|
188
|
+
|
189
|
+
message ${unknown}
|
190
|
+
]}
|
191
|
+
before do
|
192
|
+
driver.instance.log.should_receive(:warn).with("record_reformer: unknown placeholder `${unknown}` found")
|
193
|
+
end
|
194
|
+
it { emit }
|
195
|
+
end
|
196
|
+
|
180
197
|
context '${tag_prefix[N]} and ${tag_suffix[N]}' do
|
181
198
|
let(:config) {%[
|
182
199
|
type reformed
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-record-reformer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: -974723697
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
segments:
|
136
136
|
- 0
|
137
|
-
hash:
|
137
|
+
hash: -974723697
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
140
|
rubygems_version: 1.8.23
|