logstash-filter-xml 0.1.2 → 0.1.3

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: b7fd25d440b0df516cae7ba96eb400efdaa142eb
4
- data.tar.gz: 02f3550e09fc68ecc383b59f0dbf4ead4c9a999a
3
+ metadata.gz: 807ad58486117006372804beae20e62e831748d2
4
+ data.tar.gz: fd042894e9d34c478b6b664f521e11c5948d256d
5
5
  SHA512:
6
- metadata.gz: 32b9892df7bd97edc06cc5165433ff7818894fb97dc8379797fc5c6ad2ef8fd030303e69eae940214cf64372712768a049d7a0f7186c0bc1d35c653c5c29f0b5
7
- data.tar.gz: 4b9fffa4ac1b0839c0ec4f6c2bc1c81635624fc68595f6aa1d1df82a0379b6de9ff2266e556afcb097285c96a423e2b2d85392316c085e98eedde4b049fbfb63
6
+ metadata.gz: 248162f14ab8d50153f8090299280c7a27c924c5f4cfeae8e7e1f65656a0f78551e163b4a18dd35d12cc53fc16d4cbf9f3090cbff54976470bc98ce373e2eb2d
7
+ data.tar.gz: ee51dbef72a086a83deb3edb578a8f0fd329a1f7ad53a41da04bd170df5b52a3978928e98ad4dec6687e15ee7c6ee1a3e8c3c3850e0b027a8eb4c29c381a0988
@@ -0,0 +1,17 @@
1
+ The following is a list of people who have contributed ideas, code, bug
2
+ reports, or in general have helped logstash along its way.
3
+
4
+ Contributors:
5
+ * Bryan Germann (bgerm)
6
+ * Harlan Barnes (harlanbarnes)
7
+ * Jordan Sissel (jordansissel)
8
+ * Pete Fritchman (fetep)
9
+ * Philippe Weber (wiibaa)
10
+ * Pier-Hugues Pellerin (ph)
11
+ * Richard Pijnenburg (electrical)
12
+ * Suyog Rao (suyograo)
13
+
14
+ Note: If you've sent us patches, bug reports, or otherwise contributed to
15
+ Logstash, and you aren't on the list above and want to be, please let us know
16
+ and we'll make sure you're here. Contributions from folks like you are what make
17
+ open source awesome.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2014 Elasticsearch <http://www.elasticsearch.org>
1
+ Copyright (c) 2012-2015 Elasticsearch <http://www.elasticsearch.org>
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -0,0 +1,95 @@
1
+ # Logstash Plugin
2
+
3
+ This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
4
+
5
+ It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
6
+
7
+ ## Documentation
8
+
9
+ Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elasticsearch.org/guide/en/logstash/current/).
10
+
11
+ - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
12
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
13
+
14
+ ## Need Help?
15
+
16
+ Need help? Try #logstash on freenode IRC or the logstash-users@googlegroups.com mailing list.
17
+
18
+ ## Developing
19
+
20
+ ### 1. Plugin Developement and Testing
21
+
22
+ #### Code
23
+ - To get started, you'll need JRuby with the Bundler gem installed.
24
+
25
+ - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization.
26
+
27
+ - Install dependencies
28
+ ```sh
29
+ bundle install
30
+ ```
31
+
32
+ #### Test
33
+
34
+ ```sh
35
+ bundle exec rspec
36
+ ```
37
+
38
+ The Logstash code required to run the tests/specs is specified in the `Gemfile` by the line similar to:
39
+ ```ruby
40
+ gem "logstash", :github => "elasticsearch/logstash", :branch => "1.5"
41
+ ```
42
+ To test against another version or a local Logstash, edit the `Gemfile` to specify an alternative location, for example:
43
+ ```ruby
44
+ gem "logstash", :github => "elasticsearch/logstash", :ref => "master"
45
+ ```
46
+ ```ruby
47
+ gem "logstash", :path => "/your/local/logstash"
48
+ ```
49
+
50
+ Then update your dependencies and run your tests:
51
+
52
+ ```sh
53
+ bundle install
54
+ bundle exec rspec
55
+ ```
56
+
57
+ ### 2. Running your unpublished Plugin in Logstash
58
+
59
+ #### 2.1 Run in a local Logstash clone
60
+
61
+ - Edit Logstash `tools/Gemfile` and add the local plugin path, for example:
62
+ ```ruby
63
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
64
+ ```
65
+ - Update Logstash dependencies
66
+ ```sh
67
+ rake vendor:gems
68
+ ```
69
+ - Run Logstash with your plugin
70
+ ```sh
71
+ bin/logstash -e 'filter {awesome {}}'
72
+ ```
73
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
74
+
75
+ #### 2.2 Run in an installed Logstash
76
+
77
+ - Build your plugin gem
78
+ ```sh
79
+ gem build logstash-filter-awesome.gemspec
80
+ ```
81
+ - Install the plugin from the Logstash home
82
+ ```sh
83
+ bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
84
+ ```
85
+ - Start Logstash and proceed to test the plugin
86
+
87
+ ## Contributing
88
+
89
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
90
+
91
+ Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
92
+
93
+ It is more important to me that you are able to contribute.
94
+
95
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
@@ -7,7 +7,6 @@ require "logstash/namespace"
7
7
  class LogStash::Filters::Xml < LogStash::Filters::Base
8
8
 
9
9
  config_name "xml"
10
- milestone 1
11
10
 
12
11
  # Config for xml to hash is:
13
12
  # [source,ruby]
@@ -62,6 +61,10 @@ class LogStash::Filters::Xml < LogStash::Filters::Base
62
61
  # field as described above. Setting this to false will prevent that.
63
62
  config :store_xml, :validate => :boolean, :default => true
64
63
 
64
+ # Remove all namespaces from all nodes in the document.
65
+ # Of course, if the document had nodes with the same names but different namespaces, they will now be ambiguous.
66
+ config :remove_namespaces, :validate => :boolean, :default => false
67
+
65
68
  public
66
69
  def register
67
70
  require "nokogiri"
@@ -98,7 +101,7 @@ class LogStash::Filters::Xml < LogStash::Filters::Base
98
101
  :exception => e, :backtrace => e.backtrace)
99
102
  return
100
103
  end
101
-
104
+ doc.remove_namespaces! if @remove_namespaces
102
105
  @xpath.each do |xpath_src, xpath_dest|
103
106
  nodeset = doc.xpath(xpath_src)
104
107
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-xml'
4
- s.version = '0.1.2'
4
+ s.version = '0.1.3'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Takes a field that contains XML and expands it into an actual datastructure."
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -172,4 +172,38 @@ describe LogStash::Filters::Xml do
172
172
  end
173
173
  end
174
174
 
175
+ describe "parse including namespaces" do
176
+ config <<-CONFIG
177
+ filter {
178
+ xml {
179
+ source => "xmldata"
180
+ xpath => [ "/foo/h:div", "xpath_field" ]
181
+ remove_namespaces => false
182
+ }
183
+ }
184
+ CONFIG
185
+
186
+ # Single value
187
+ sample("xmldata" => '<foo xmlns:h="http://www.w3.org/TR/html4/"><h:div>Content</h:div></foo>') do
188
+ insist { subject["xpath_field"] } == ["<h:div>Content</h:div>"]
189
+ end
190
+ end
191
+
192
+ describe "parse removing namespaces" do
193
+ config <<-CONFIG
194
+ filter {
195
+ xml {
196
+ source => "xmldata"
197
+ xpath => [ "/foo/div", "xpath_field" ]
198
+ remove_namespaces => true
199
+ }
200
+ }
201
+ CONFIG
202
+
203
+ # Single value
204
+ sample("xmldata" => '<foo xmlns:h="http://www.w3.org/TR/html4/"><h:div>Content</h:div></foo>') do
205
+ insist { subject["xpath_field"] } == ["<div>Content</div>"]
206
+ end
207
+ end
208
+
175
209
  end
metadata CHANGED
@@ -1,18 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elasticsearch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: logstash
15
- version_requirements: !ruby/object:Gem::Requirement
14
+ requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - '>='
18
17
  - !ruby/object:Gem::Version
@@ -20,7 +19,10 @@ dependencies:
20
19
  - - <
21
20
  - !ruby/object:Gem::Version
22
21
  version: 2.0.0
23
- requirement: !ruby/object:Gem::Requirement
22
+ name: logstash
23
+ prerelease: false
24
+ type: :runtime
25
+ version_requirements: !ruby/object:Gem::Requirement
24
26
  requirements:
25
27
  - - '>='
26
28
  - !ruby/object:Gem::Version
@@ -28,50 +30,48 @@ dependencies:
28
30
  - - <
29
31
  - !ruby/object:Gem::Version
30
32
  version: 2.0.0
31
- prerelease: false
32
- type: :runtime
33
33
  - !ruby/object:Gem::Dependency
34
- name: nokogiri
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - '>='
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
34
  requirement: !ruby/object:Gem::Requirement
41
35
  requirements:
42
36
  - - '>='
43
37
  - !ruby/object:Gem::Version
44
38
  version: '0'
39
+ name: nokogiri
45
40
  prerelease: false
46
41
  type: :runtime
47
- - !ruby/object:Gem::Dependency
48
- name: xml-simple
49
42
  version_requirements: !ruby/object:Gem::Requirement
50
43
  requirements:
51
44
  - - '>='
52
45
  - !ruby/object:Gem::Version
53
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
54
48
  requirement: !ruby/object:Gem::Requirement
55
49
  requirements:
56
50
  - - '>='
57
51
  - !ruby/object:Gem::Version
58
52
  version: '0'
53
+ name: xml-simple
59
54
  prerelease: false
60
55
  type: :runtime
61
- - !ruby/object:Gem::Dependency
62
- name: logstash-devutils
63
56
  version_requirements: !ruby/object:Gem::Requirement
64
57
  requirements:
65
58
  - - '>='
66
59
  - !ruby/object:Gem::Version
67
60
  version: '0'
61
+ - !ruby/object:Gem::Dependency
68
62
  requirement: !ruby/object:Gem::Requirement
69
63
  requirements:
70
64
  - - '>='
71
65
  - !ruby/object:Gem::Version
72
66
  version: '0'
67
+ name: logstash-devutils
73
68
  prerelease: false
74
69
  type: :development
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
75
  description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
76
76
  email: info@elasticsearch.com
77
77
  executables: []
@@ -79,8 +79,10 @@ extensions: []
79
79
  extra_rdoc_files: []
80
80
  files:
81
81
  - .gitignore
82
+ - CONTRIBUTORS
82
83
  - Gemfile
83
84
  - LICENSE
85
+ - README.md
84
86
  - Rakefile
85
87
  - lib/logstash/filters/xml.rb
86
88
  - logstash-filter-xml.gemspec
@@ -107,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
109
  version: '0'
108
110
  requirements: []
109
111
  rubyforge_project:
110
- rubygems_version: 2.4.4
112
+ rubygems_version: 2.1.9
111
113
  signing_key:
112
114
  specification_version: 4
113
115
  summary: Takes a field that contains XML and expands it into an actual datastructure.