fluent-plugin-xml 0.1.0 → 0.1.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 +4 -4
- data/fluent-plugin-xml.gemspec +1 -1
- data/lib/fluent/plugin/parser_xml.rb +12 -11
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd2ba740a530d4365e67a5e68b1c282889417b741c88c8e7cb8d17c5b0f691fa
|
4
|
+
data.tar.gz: 87a3c1412d3f58de86b2b4599a153ff6c0058a509e0b69495f435af38fa4543d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbae6ac8b259c4385e77863989a15f3aba11d1351ba99b7f8834332aca738d7faa8f299276b8f6db09cc4197c4f73a227131f3c538f410b7a3a9a58c7e709da1
|
7
|
+
data.tar.gz: afc8809ee2e90ca34a8ad9b93efdb1b460fc709640254fe28331416c55aa1a38f5a7e1192d70711e3014ceed608482ae01ccaa9ec20367ea012eea27ce14df4f
|
data/fluent-plugin-xml.gemspec
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
16
|
require 'fluent/plugin/parser'
|
17
|
-
require '
|
17
|
+
require 'nokogiri'
|
18
18
|
|
19
19
|
module Fluent
|
20
20
|
module Plugin
|
@@ -36,7 +36,8 @@ module Fluent
|
|
36
36
|
def parse(text)
|
37
37
|
begin
|
38
38
|
# Open the XML document
|
39
|
-
doc =
|
39
|
+
doc = Nokogiri.XML(text)
|
40
|
+
doc.remove_namespaces!
|
40
41
|
|
41
42
|
# Create an empty record which assigns default values for missing
|
42
43
|
# keys. See: https://stackoverflow.com/a/3339168.
|
@@ -63,9 +64,8 @@ module Fluent
|
|
63
64
|
end
|
64
65
|
|
65
66
|
yield(time, record)
|
66
|
-
rescue
|
67
|
-
|
68
|
-
$log.debug_backtrace(e.backtrace)
|
67
|
+
rescue StandardError
|
68
|
+
yield(nil, nil)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -89,13 +89,14 @@ module Fluent
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def get_field_value(doc, xpath)
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
attribute = element.attributes[xpath[1]]
|
96
|
-
return if attribute.nil?
|
92
|
+
begin
|
93
|
+
elements = doc.xpath(xpath[0])
|
94
|
+
throw if elements.nil?
|
97
95
|
|
98
|
-
|
96
|
+
return elements.first[xpath[1]]
|
97
|
+
rescue StandardError
|
98
|
+
return
|
99
|
+
end
|
99
100
|
end
|
100
101
|
|
101
102
|
def deep_each_pair(hash, parents = [])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rémy DUTHU
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
|
-
rubygems_version: 3.0.3
|
109
|
+
rubygems_version: 3.0.3.1
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: A Fluentd parser plugin to extract attributes from XML data
|