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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44c77dc562482affd2975f6a695a00307610d9e0
4
- data.tar.gz: e0db1b2675515ce230dfd0b987100b79cb6aa34e
3
+ metadata.gz: f0a48362b3ec5bda67530a485381c220b65eec7e
4
+ data.tar.gz: 8cc9b53c652ace303ae3fc8556d5de9103256ec1
5
5
  SHA512:
6
- metadata.gz: 4e8a95bcb3ad0c5481b8603524cda28a9678cb3a2ea29a535e17c2da95d24357b47bbdd017b19ed309fa2062de69e07ef7900cec13460f23fd34966b5a01d00f
7
- data.tar.gz: c6075abd38b55ef0a88042fbb59d39c6cd21607863a8c8c003f66a29e5649a91f7a5510881555290d43a57cb72930d5b08da5ef7b070114186d91645b604b6f3
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
- fluent-plugin-xml-parser provides input data conversion from XML to JSON for
22
- simple case, like sensor data. It can be specified at source directive as
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 description for Libelium SmartCity sensor data.
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 1883
33
+ port 11883
34
+ topic 'Libelium/+/#'
33
35
  format xml
34
36
  time_xpath '["cap:alert/cap:info/cap:onset", "text"]'
35
- attr_xpaths '[[null, "description"], ["cap:alert/cap:info/cap:parameter/cap:valueName", "text"]]'
36
- value_xpaths '[["cap:alert/cap:info/cap:description", "text"], ["cap:alert/cap:info/cap:parameter/cap:value", "text"]]'
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
- time_xpath specifies timestamp filed value. An array with two strings means xpath of
42
- the value and the attribute of the XML element (name, text etc).
43
-
44
- attr_xpaths indicates attribute name of the target value. Each array with two strings
45
- means xpath of the attribute name and the attribute of the XML element (name, text etc).
46
- XPath can be omitted as 'null' and specify your own attribute name as the second
47
- parameter.
48
-
49
- value_xpaths indicates the target value to be extracted. Each array with two strings
50
- means xpath of the target value and the attribute of the XML element (name, text etc).
51
- XPath can be omitted as 'null' and specify your own value as the second parameter.
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.4"
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
- @time_xpath = json_parse(conf['time_xpath'])
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
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-05 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler