fluent-plugin-xml-simple-filter 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/fluent-plugin-xml-simple-filter.gemspec +2 -2
- data/lib/fluent/plugin/filter_xml_simple.rb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a1def9069be715d20f8304004a885d90952c870
|
4
|
+
data.tar.gz: c68e4ecf0fbb79db769ccf1008718276cdccd596
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90d5224dc82c28f58b799a99f7ce41efff15c677acdf98822e8efde1dbe65c57ab6e06f48e79063b463f0d817685e669cdc53d4a365df20c9fbba9b98ceff484
|
7
|
+
data.tar.gz: 1a0cff0178c9c5563ab3351e2f2e76610dd7a3686d7a77a45863c55c01404ef74fef6a57c3c525a1674860f4368bdba58c72418d344b95a21c81f583597cd7f6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.9
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: fluent-plugin-xml-simple-filter 0.0.
|
5
|
+
# stub: fluent-plugin-xml-simple-filter 0.0.9 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "fluent-plugin-xml-simple-filter".freeze
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.9"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
@@ -7,6 +7,7 @@ module Fluent
|
|
7
7
|
config_param :fields, :string
|
8
8
|
|
9
9
|
config_param :try_convert_times, :bool, :default => true # try to convert values in hash to times
|
10
|
+
config_param :time_format, :string, :default => '%F'
|
10
11
|
config_param :field_name_postfix, :string, :default => 'hash' # if set will create hash in new field with postfix (xml => xml_hash)
|
11
12
|
|
12
13
|
def configure(conf)
|
@@ -42,11 +43,7 @@ module Fluent
|
|
42
43
|
|
43
44
|
hash = @parser.parse(record[field])
|
44
45
|
|
45
|
-
|
46
|
-
hash = convert_times(hash)
|
47
|
-
end
|
48
|
-
|
49
|
-
record[field_name] = hash
|
46
|
+
record[field_name] = self.try_convert_times ? convert_times(hash) : hash
|
50
47
|
end
|
51
48
|
}
|
52
49
|
|
@@ -56,7 +53,11 @@ module Fluent
|
|
56
53
|
private
|
57
54
|
|
58
55
|
def convert_times(hash)
|
59
|
-
hash.each { |key, value|
|
56
|
+
hash.each { |key, value|
|
57
|
+
value.class == Hash ? convert_times(value) : try_to_convert(value) { |x|
|
58
|
+
self.time_format ? Time.strptime(x, self.time_format) : Time.parse(x)
|
59
|
+
}
|
60
|
+
}
|
60
61
|
end
|
61
62
|
|
62
63
|
def try_to_convert(value, &block)
|