logstash-filter-htmlentities 0.1.0.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +2 -0
- data/CONTRIBUTORS +10 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +28 -0
- data/lib/logstash/filters/htmlentities.rb +38 -0
- data/logstash-filter-htmlentities.gemspec +24 -0
- data/spec/filters/htmlentities_spec.rb +21 -0
- data/spec/spec_helper.rb +4 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eddd8290ea416c8d835a7477611c0e4e9560e787
|
4
|
+
data.tar.gz: 75ac596dc251d9520411cd729a68ea64ea6ca7fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0aa0969fcb4eb9f36e20ffad95315976de8ca783df14021145a55e32d148a4c91b77766f201ac5dfc630c1b62e51871d1606b608a2e4d1c447ff524494873d1b
|
7
|
+
data.tar.gz: 90582f1ae9ceb8f9ad916b5aa0df6250f5f7250740a7ca628649090fce16f5bf49b75ee0d133c6070891295436dd8af9ad192aa4c88a972c86a335a6d9fe4d3d
|
data/CHANGELOG.md
ADDED
data/CONTRIBUTORS
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
The following is a list of people who have contributed ideas, code, bug
|
2
|
+
reports, or in general have helped logstash-filter-htmlentities along its way.
|
3
|
+
|
4
|
+
Contributors:
|
5
|
+
* David Robakowski (drobakowski)
|
6
|
+
|
7
|
+
Note: If you've sent us patches, bug reports, or otherwise contributed to
|
8
|
+
logstash-filter-htmlentities, and you aren't on the list above and want to be,
|
9
|
+
please let us know and we'll make sure you're here. Contributions from folks
|
10
|
+
like you are what make open source awesome.
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016, Synlay Technologies UG & Co. KG.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Logstash Filter HTMLEntities Plugin
|
2
|
+
|
3
|
+
[![Travis Build Status](https://travis-ci.org/synlay/logstash-filter-htmlentities.svg)](https://travis-ci.org/synlay/logstash-filter-htmlentities)
|
4
|
+
|
5
|
+
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
6
|
+
|
7
|
+
It is fully free and fully open source. The license is MIT, see [LICENSE](http://github.com/synlay/logstash-filter-htmlentities/LICENSE) for further infos.
|
8
|
+
|
9
|
+
## Documentation
|
10
|
+
|
11
|
+
This filter will decode (X)HTML entities from a given source field and store the result to the target field.
|
12
|
+
|
13
|
+
### 1. Configuration
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
filter {
|
17
|
+
htmlentities {
|
18
|
+
source => "test_source_field"
|
19
|
+
target => "test_target_field"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
```
|
23
|
+
|
24
|
+
This configuration will encode the source field `test_source_field` e.q. with data "Examples & Explanations" to "Examples & Explanations" and store the result to the field `test_target_field`.
|
25
|
+
|
26
|
+
## Developing
|
27
|
+
|
28
|
+
For further instructions on howto develop on logstash plugins, please see the documentation of the official [logstash-filter-example](https://github.com/logstash-plugins/logstash-filter-example#developing).
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/filters/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
require "htmlentities"
|
5
|
+
|
6
|
+
class LogStash::Filters::HTMLEntities < LogStash::Filters::Base
|
7
|
+
config_name "htmlentities"
|
8
|
+
|
9
|
+
# The field to perform filter
|
10
|
+
#
|
11
|
+
config :source, :validate => :string, :default => "message"
|
12
|
+
|
13
|
+
# The name of the container to put the result
|
14
|
+
#
|
15
|
+
config :target, :validate => :string, :default => "message"
|
16
|
+
|
17
|
+
|
18
|
+
public
|
19
|
+
def register
|
20
|
+
@coder = HTMLEntities.new
|
21
|
+
end # def register
|
22
|
+
|
23
|
+
public
|
24
|
+
def filter(event)
|
25
|
+
|
26
|
+
if @source
|
27
|
+
# Replace the event message with our message as configured in the
|
28
|
+
# config file.
|
29
|
+
event.set(@target, @coder.decode(event.get(@source)))
|
30
|
+
# correct debugging log statement for reference
|
31
|
+
# using the event.get API
|
32
|
+
@logger.debug? && @logger.debug("#{@target} is now: #{event.get(@target)}")
|
33
|
+
end
|
34
|
+
|
35
|
+
# filter_matched should go in the last line of our successful code
|
36
|
+
filter_matched(event)
|
37
|
+
end # def filter
|
38
|
+
end # class LogStash::Filters::Example
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'logstash-filter-htmlentities'
|
3
|
+
s.version = '0.1.0-alpha'
|
4
|
+
s.licenses = ['MIT']
|
5
|
+
s.summary = "Logstash filter for decoding (X)HTML entities from event fields"
|
6
|
+
s.description = "A Logstash filter plugin for decoding (X)HTML entities from event fields. This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gem_name. This gem is not a stand-alone program."
|
7
|
+
s.authors = ["David Robakowski"]
|
8
|
+
s.email = 'david.robakowski@synlay.com'
|
9
|
+
s.homepage = "https://github.com/synlay/logstash-filter-htmlentities"
|
10
|
+
s.require_paths = ["lib"]
|
11
|
+
|
12
|
+
# Files
|
13
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
14
|
+
# Tests
|
15
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
16
|
+
|
17
|
+
# Special flag to let us know this is actually a logstash plugin
|
18
|
+
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
|
19
|
+
|
20
|
+
# Gem dependencies
|
21
|
+
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
22
|
+
s.add_runtime_dependency 'htmlentities', '~> 4.3', '>= 4.3.4'
|
23
|
+
s.add_development_dependency 'logstash-devutils'
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require "logstash/filters/htmlentities"
|
4
|
+
|
5
|
+
describe LogStash::Filters::HTMLEntities do
|
6
|
+
describe "Simple HTML entity encoding of source field `test_source_field` while storing the result to field `test_target_field`" do
|
7
|
+
let(:config) do <<-CONFIG
|
8
|
+
filter {
|
9
|
+
htmlentities {
|
10
|
+
source => "test_source_field"
|
11
|
+
target => "test_target_field"
|
12
|
+
}
|
13
|
+
}
|
14
|
+
CONFIG
|
15
|
+
end
|
16
|
+
|
17
|
+
sample("test_source_field" => "Examples & Explanations") do
|
18
|
+
expect(subject.get("test_target_field")).to eq("Examples & Explanations")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-filter-htmlentities
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.pre.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Robakowski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ~>
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '2.0'
|
19
|
+
name: logstash-core-plugin-api
|
20
|
+
prerelease: false
|
21
|
+
type: :runtime
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4.3'
|
33
|
+
- - '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 4.3.4
|
36
|
+
name: htmlentities
|
37
|
+
prerelease: false
|
38
|
+
type: :runtime
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.3'
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 4.3.4
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
name: logstash-devutils
|
54
|
+
prerelease: false
|
55
|
+
type: :development
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
description: A Logstash filter plugin for decoding (X)HTML entities from event fields. This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gem_name. This gem is not a stand-alone program.
|
62
|
+
email: david.robakowski@synlay.com
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- CHANGELOG.md
|
68
|
+
- CONTRIBUTORS
|
69
|
+
- Gemfile
|
70
|
+
- LICENSE
|
71
|
+
- README.md
|
72
|
+
- lib/logstash/filters/htmlentities.rb
|
73
|
+
- logstash-filter-htmlentities.gemspec
|
74
|
+
- spec/filters/htmlentities_spec.rb
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
homepage: https://github.com/synlay/logstash-filter-htmlentities
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata:
|
80
|
+
logstash_plugin: 'true'
|
81
|
+
logstash_group: filter
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '>'
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.3.1
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.4.5
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: Logstash filter for decoding (X)HTML entities from event fields
|
102
|
+
test_files:
|
103
|
+
- spec/filters/htmlentities_spec.rb
|
104
|
+
- spec/spec_helper.rb
|