logstash-filter-xml 4.0.2 → 4.0.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: 7758cb2a1b75e1ec1f02f0d31f6d3592d27f5c8c
4
- data.tar.gz: f1af18c5f4c689cafc1c38e5bb32bd5f8ab45631
3
+ metadata.gz: 7d881613a9476f371194d156039ef75376370ea1
4
+ data.tar.gz: cc62baf200c453069fc2aa700d055520721a6a02
5
5
  SHA512:
6
- metadata.gz: 72bb73bf8def84fc335661e29d361521bd77b7c07e1b55fb0db650dadcc26958d410464eadb079ef8447c30758dda185e867bb64cfe6b39b425884cc42a4f46e
7
- data.tar.gz: acd1c0e7ba251a177f8d8c25534fabeddc9ec7d0adbba7c87ceedd13ea90f82603467c04022db98c1906d02a98bc57d24d3dca7ad289da550f5ad45916362e6e
6
+ metadata.gz: 5e05791be78c175edcb859708c53f3ada769a7212bd9b85f1a424c7367dfe6fcc6f9e2a6eb7a38025a779c6fdba86f75bc2930ed113f3f7bea2aa116bafe6028
7
+ data.tar.gz: 0caaa2f55c9e761095efd82147b1b0c986f1d4078c15e3cc31b5f1a37803ddb11f0ba3c3e4809693c7c5a2b9ee9a3bd7cc04d943d5cd2b7fe3c273948372e66f
data/Gemfile CHANGED
@@ -1,4 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in logstash-mass_effect.gemspec
4
3
  gemspec
4
+
5
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
+
8
+ if Dir.exist?(logstash_path) && use_logstash_source
9
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
+ end
@@ -0,0 +1,187 @@
1
+ :plugin: xml
2
+ :type: filter
3
+
4
+ ///////////////////////////////////////////
5
+ START - GENERATED VARIABLES, DO NOT EDIT!
6
+ ///////////////////////////////////////////
7
+ :version: %VERSION%
8
+ :release_date: %RELEASE_DATE%
9
+ :changelog_url: %CHANGELOG_URL%
10
+ :include_path: ../../../../logstash/docs/include
11
+ ///////////////////////////////////////////
12
+ END - GENERATED VARIABLES, DO NOT EDIT!
13
+ ///////////////////////////////////////////
14
+
15
+ [id="plugins-{type}-{plugin}"]
16
+
17
+ === Xml filter plugin
18
+
19
+ include::{include_path}/plugin_header.asciidoc[]
20
+
21
+ ==== Description
22
+
23
+ XML filter. Takes a field that contains XML and expands it into
24
+ an actual datastructure.
25
+
26
+ [id="plugins-{type}s-{plugin}-options"]
27
+ ==== Xml Filter Configuration Options
28
+
29
+ This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
30
+
31
+ [cols="<,<,<",options="header",]
32
+ |=======================================================================
33
+ |Setting |Input type|Required
34
+ | <<plugins-{type}s-{plugin}-force_array>> |<<boolean,boolean>>|No
35
+ | <<plugins-{type}s-{plugin}-force_content>> |<<boolean,boolean>>|No
36
+ | <<plugins-{type}s-{plugin}-namespaces>> |<<hash,hash>>|No
37
+ | <<plugins-{type}s-{plugin}-remove_namespaces>> |<<boolean,boolean>>|No
38
+ | <<plugins-{type}s-{plugin}-source>> |<<string,string>>|Yes
39
+ | <<plugins-{type}s-{plugin}-store_xml>> |<<boolean,boolean>>|No
40
+ | <<plugins-{type}s-{plugin}-suppress_empty>> |<<boolean,boolean>>|No
41
+ | <<plugins-{type}s-{plugin}-target>> |<<string,string>>|No
42
+ | <<plugins-{type}s-{plugin}-xpath>> |<<hash,hash>>|No
43
+ |=======================================================================
44
+
45
+ Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
46
+ filter plugins.
47
+
48
+ &nbsp;
49
+
50
+ [id="plugins-{type}s-{plugin}-force_array"]
51
+ ===== `force_array`
52
+
53
+ * Value type is <<boolean,boolean>>
54
+ * Default value is `true`
55
+
56
+ By default the filter will force single elements to be arrays. Setting this to
57
+ false will prevent storing single elements in arrays.
58
+
59
+ [id="plugins-{type}s-{plugin}-force_content"]
60
+ ===== `force_content`
61
+
62
+ * Value type is <<boolean,boolean>>
63
+ * Default value is `false`
64
+
65
+ By default the filter will expand attributes differently from content inside
66
+ of tags. This option allows you to force text content and attributes to always
67
+ parse to a hash value.
68
+
69
+ [id="plugins-{type}s-{plugin}-namespaces"]
70
+ ===== `namespaces`
71
+
72
+ * Value type is <<hash,hash>>
73
+ * Default value is `{}`
74
+
75
+ By default only namespaces declarations on the root element are considered.
76
+ This allows to configure all namespace declarations to parse the XML document.
77
+
78
+ Example:
79
+
80
+ [source,ruby]
81
+ filter {
82
+ xml {
83
+ namespaces => {
84
+ "xsl" => "http://www.w3.org/1999/XSL/Transform"
85
+ "xhtml" => http://www.w3.org/1999/xhtml"
86
+ }
87
+ }
88
+ }
89
+
90
+
91
+ [id="plugins-{type}s-{plugin}-remove_namespaces"]
92
+ ===== `remove_namespaces`
93
+
94
+ * Value type is <<boolean,boolean>>
95
+ * Default value is `false`
96
+
97
+ Remove all namespaces from all nodes in the document.
98
+ Of course, if the document had nodes with the same names but different namespaces, they will now be ambiguous.
99
+
100
+ [id="plugins-{type}s-{plugin}-source"]
101
+ ===== `source`
102
+
103
+ * This is a required setting.
104
+ * Value type is <<string,string>>
105
+ * There is no default value for this setting.
106
+
107
+ Config for xml to hash is:
108
+ [source,ruby]
109
+ source => source_field
110
+
111
+ For example, if you have the whole XML document in your `message` field:
112
+ [source,ruby]
113
+ filter {
114
+ xml {
115
+ source => "message"
116
+ }
117
+ }
118
+
119
+ The above would parse the XML from the `message` field.
120
+
121
+ [id="plugins-{type}s-{plugin}-store_xml"]
122
+ ===== `store_xml`
123
+
124
+ * Value type is <<boolean,boolean>>
125
+ * Default value is `true`
126
+
127
+ By default the filter will store the whole parsed XML in the destination
128
+ field as described above. Setting this to false will prevent that.
129
+
130
+ [id="plugins-{type}s-{plugin}-suppress_empty"]
131
+ ===== `suppress_empty`
132
+
133
+ * Value type is <<boolean,boolean>>
134
+ * Default value is `true`
135
+
136
+ By default, output nothing if the element is empty.
137
+ If set to `false`, empty element will result in an empty hash object.
138
+
139
+ [id="plugins-{type}s-{plugin}-target"]
140
+ ===== `target`
141
+
142
+ * Value type is <<string,string>>
143
+ * There is no default value for this setting.
144
+
145
+ Define target for placing the data
146
+
147
+ For example if you want the data to be put in the `doc` field:
148
+ [source,ruby]
149
+ filter {
150
+ xml {
151
+ target => "doc"
152
+ }
153
+ }
154
+
155
+ XML in the value of the source field will be expanded into a
156
+ datastructure in the `target` field.
157
+ Note: if the `target` field already exists, it will be overridden.
158
+ Required if `store_xml` is true (which is the default).
159
+
160
+ [id="plugins-{type}s-{plugin}-xpath"]
161
+ ===== `xpath`
162
+
163
+ * Value type is <<hash,hash>>
164
+ * Default value is `{}`
165
+
166
+ xpath will additionally select string values (non-strings will be
167
+ converted to strings with Ruby's `to_s` function) from parsed XML
168
+ (using each source field defined using the method above) and place
169
+ those values in the destination fields. Configuration:
170
+ [source,ruby]
171
+ xpath => [ "xpath-syntax", "destination-field" ]
172
+
173
+ Values returned by XPath parsing from `xpath-syntax` will be put in the
174
+ destination field. Multiple values returned will be pushed onto the
175
+ destination field as an array. As such, multiple matches across
176
+ multiple source fields will produce duplicate entries in the field.
177
+
178
+ More on XPath: http://www.w3schools.com/xml/xml_xpath.asp
179
+
180
+ The XPath functions are particularly powerful:
181
+ http://www.w3schools.com/xsl/xsl_functions.asp
182
+
183
+
184
+
185
+
186
+ [id="plugins-{type}s-{plugin}-common-options"]
187
+ include::{include_path}/{type}.asciidoc[]
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-xml'
4
- s.version = '4.0.2'
4
+ s.version = '4.0.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/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
14
- s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
14
+ s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -382,19 +382,4 @@ describe LogStash::Filters::Xml do
382
382
  end
383
383
  end
384
384
  end
385
-
386
- describe "plugin registration" do
387
- config <<-CONFIG
388
- filter {
389
- xml {
390
- xmldata => "message"
391
- store_xml => true
392
- }
393
- }
394
- CONFIG
395
-
396
- sample("xmldata" => "<foo>random message</foo>") do
397
- insist { subject }.raises(LogStash::ConfigurationError)
398
- end
399
- end
400
385
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-31 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +84,7 @@ files:
84
84
  - LICENSE
85
85
  - NOTICE.TXT
86
86
  - README.md
87
+ - docs/index.asciidoc
87
88
  - lib/logstash/filters/xml.rb
88
89
  - logstash-filter-xml.gemspec
89
90
  - spec/filters/xml_spec.rb