fluent-plugin-xml-parser 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -18
- data/fluent-plugin-xml-parser.gemspec +1 -1
- data/lib/fluent/plugin/parser_xml.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0a48362b3ec5bda67530a485381c220b65eec7e
|
4
|
+
data.tar.gz: 8cc9b53c652ace303ae3fc8556d5de9103256ec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acc2cdc20253747a2e2ded6ae38f041ed2564d1ce7d81f3e34ff1f4da957fcf32d2af050d05a32cc70e00c4e97967d9c681cbd2dfffa8b828ff68c8c83b70148
|
7
|
+
data.tar.gz: 7e87df627cab43517283235798bb7eab1e725490132be94b906df260ea70398d5680eac0ad436e160d8c154ffb8ef962c8969a4648d8c24c7f5b61a7c4133975
|
data/README.md
CHANGED
@@ -18,37 +18,48 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
'format' option
|
21
|
+
Fluent::Plugin::XmlParser provides input data conversion from simple XML data
|
22
|
+
like sensor data into Ruby hash structure for emitting next procedure in fluentd.
|
23
|
+
In order to enable Fluent::Plugin::XmlParser, 'format xml' option needs to be
|
24
|
+
specified at 'source' directive.
|
24
25
|
|
25
|
-
The followings are an example
|
26
|
+
The followings are an example configuration for reformatting Libelium SmartCity sensor data to fit ElasticSearch received via MQTT protocol([fluent-plugin-mqtt-io](https://github.com/toyokazu/fluent-plugin-mqtt-io)).
|
26
27
|
|
27
28
|
```
|
28
29
|
|
29
30
|
<source>
|
30
31
|
type mqtt
|
31
32
|
bind 127.0.0.1
|
32
|
-
port
|
33
|
+
port 11883
|
34
|
+
topic 'Libelium/+/#'
|
33
35
|
format xml
|
34
36
|
time_xpath '["cap:alert/cap:info/cap:onset", "text"]'
|
35
|
-
|
36
|
-
|
37
|
+
time_key '@timestamp'
|
38
|
+
attr_xpaths '[["cap:alert/cap:info/cap:parameter/cap:valueName", "text"]]'
|
39
|
+
value_xpaths '[["cap:alert/cap:info/cap:parameter/cap:value", "text"]]'
|
40
|
+
@label @MQTT_OUT
|
37
41
|
</source>
|
38
42
|
|
39
43
|
```
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
Configurable options are the following:
|
46
|
+
|
47
|
+
- **time_xpath**: A value for fluentd time field. An array with two strings means xpath of
|
48
|
+
the value and the attribute of the XML element (name, text etc). If this option is
|
49
|
+
omitted, current time is used.
|
50
|
+
- **time_key**: An attribute name of extra timestamp field appended to the record. If Output
|
51
|
+
Plugin does not provide timestamp configuration, you can specify field name by this option.
|
52
|
+
If this option is omitted, extra timestamp field is not appended.
|
53
|
+
- **time_format**: You can specify time format. If this is omitted, ISO8601 format is used.
|
54
|
+
- **attr_xpaths**: indicates attribute name of the target value. Each array with two strings
|
55
|
+
means xpath of the attribute name and the attribute of the XML element (name, text etc).
|
56
|
+
XPath can be omitted as 'null' and specify your own attribute name as the second
|
57
|
+
parameter.
|
58
|
+
- **value_xpaths**: indicates the target value to be extracted. Each array with two strings
|
59
|
+
means xpath of the target value and the attribute of the XML element (name, text etc) and
|
60
|
+
each value is stored into the Hash with the key specified at an array instance in the
|
61
|
+
**attr_xpaths** with the same index. XPath can be omitted as 'null' and specify your own
|
62
|
+
value as the second parameter.
|
52
63
|
|
53
64
|
The extracted fields are packed into Hash structure (record field) to emit the next procedure in fluentd.
|
54
65
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-xml-parser"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.5"
|
8
8
|
spec.authors = ["Toyokazu Akiyama"]
|
9
9
|
spec.email = ["toyokazu@gmail.com"]
|
10
10
|
spec.summary = %q{fluentd xml parser plugin}
|
@@ -36,7 +36,11 @@ module Fluent
|
|
36
36
|
def configure(conf)
|
37
37
|
super
|
38
38
|
|
39
|
-
|
39
|
+
if conf['time_xpath'].nil?
|
40
|
+
@time_xpath = nil
|
41
|
+
else
|
42
|
+
@time_xpath = json_parse(conf['time_xpath'])
|
43
|
+
end
|
40
44
|
@time_key = conf['time_key']
|
41
45
|
@time_format = conf['time_format']
|
42
46
|
@time_parser = TimeParser.new(@time_format)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-xml-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toyokazu Akiyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|