logstash-filter-punct 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTUzN2Q4YjcyZDM5ZGM5Nzc1NmEzM2Y5YWU3NmVhOTNhNTg3ZjNlMQ==
5
+ data.tar.gz: !binary |-
6
+ Y2IzMzIyZGY1OTU4Y2M2MjI2YTY0Yzc2ZDhlZDUwMGVlNDZhZWU3Yw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDQ0MWJhZmRlOTIzNTk0MDBkYWZlYWExNmVjNmVhMTk5OGFjZDlkYzBmYTM2
10
+ YWI0NzY3MzY5ZDc2MzMyM2U5MjU3MTg5MjVmNDlhOGVlYmViMmVmMzFlYmY1
11
+ NTZkMmRiMzQyZWNmOTU1ZGU0YTQyMDEyNDljOTViMmU0ZjNiOWE=
12
+ data.tar.gz: !binary |-
13
+ NWUwNjg1NTAzNjc0MzZlMDk2OWRjOTAzMDhlMjg2YmJjMGY5OGYxZmE1YWMz
14
+ MDA3ZDM2MjEzNzY0NDM5ZThjMzJiYTZlODU2NTgyNDQ3ZjJjNTNmNjA5MjJl
15
+ YzUwZGZhYmNiYmNmNzk0YWI3NWJlOGExNjI1MzliNjMwMDM5NjA=
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+ gem 'rake'
3
+ gem 'gem_publisher'
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require "gem_publisher"
2
+
3
+ desc "Publish gem to RubyGems.org"
4
+ task :publish_gem do |t|
5
+ gem = GemPublisher.publish_if_updated("logstash-filter-punct.gemspec", :rubygems)
6
+ puts "Published #{gem}" if gem
7
+ end
8
+
9
+ task :default do
10
+ system("rake -T")
11
+ end
12
+
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+ require "logstash/filters/base"
3
+ require "logstash/namespace"
4
+
5
+
6
+ # Strip everything but punctuation from a field and store the remainder in the
7
+ # a separate field. This is often used for fingerprinting log events.
8
+ class LogStash::Filters::Punct < LogStash::Filters::Base
9
+ config_name "punct"
10
+ milestone 1
11
+
12
+ # The field reference to use for punctuation stripping
13
+ config :source, :validate => :string, :default => "message"
14
+
15
+ # The field to store the result.
16
+ config :target, :validate => :string, :default => "punct"
17
+
18
+ public
19
+ def register
20
+ # Nothing to do
21
+ end # def register
22
+
23
+ public
24
+ def filter(event)
25
+ return unless filter?(event)
26
+
27
+ original_value = event[@source]
28
+
29
+ # If for some reason the field is an array of values, take the first only.
30
+ original_value = original_value.first if original_value.is_a?(Array)
31
+ event[@target] = original_value.tr('A-Za-z0-9 \t','').force_encoding(Encoding::UTF_8)
32
+ end # def filter
33
+ end # class LogStash::Filters::Punct
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |s|
2
+
3
+ s.name = 'logstash-filter-punct'
4
+ s.version = '0.1.0'
5
+ s.licenses = ['Apache License (2.0)']
6
+ s.summary = "Strip everything but punctuation from a field and store the remainder in a separate field. This is often used for fingerprinting log events."
7
+ s.description = "Strip everything but punctuation from a field and store the remainder in a separate field. This is often used for fingerprinting log events."
8
+ s.authors = ["Elasticsearch"]
9
+ s.email = 'richard.pijnenburg@elasticsearch.com'
10
+ s.homepage = "http://logstash.net/"
11
+ s.require_paths = ["lib"]
12
+
13
+ # Files
14
+ s.files = `git ls-files`.split($\)
15
+
16
+ # Tests
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+
19
+ # Special flag to let us know this is actually a logstash plugin
20
+ s.metadata = { "logstash_plugin" => "true", "group" => "filter" }
21
+
22
+ # Gem dependencies
23
+ s.add_runtime_dependency 'logstash', '>= 1.4.0', '< 2.0.0'
24
+
25
+ end
26
+
@@ -0,0 +1,18 @@
1
+ require "test_utils"
2
+ require "logstash/filters/punct"
3
+
4
+ describe LogStash::Filters::Punct do
5
+ extend LogStash::RSpec
6
+
7
+ describe "all defaults" do
8
+ config <<-CONFIG
9
+ filter {
10
+ punct { }
11
+ }
12
+ CONFIG
13
+
14
+ sample "PHP Warning: json_encode() [<a href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument in /var/www/htdocs/test.php on line 233" do
15
+ insist { subject["punct"] } == ":_()[<='.-'>.-</>]:-////."
16
+ end
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-filter-punct
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Elasticsearch
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logstash
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: !binary |-
20
+ MS40LjA=
21
+ - - <
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.0
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: !binary |-
31
+ MS40LjA=
32
+ - - <
33
+ - !ruby/object:Gem::Version
34
+ version: 2.0.0
35
+ description: Strip everything but punctuation from a field and store the remainder
36
+ in a separate field. This is often used for fingerprinting log events.
37
+ email: richard.pijnenburg@elasticsearch.com
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - .gitignore
43
+ - Gemfile
44
+ - Rakefile
45
+ - lib/logstash/filters/punct.rb
46
+ - logstash-filter-punct.gemspec
47
+ - spec/filters/punct.rb
48
+ homepage: http://logstash.net/
49
+ licenses:
50
+ - Apache License (2.0)
51
+ metadata:
52
+ logstash_plugin: 'true'
53
+ group: filter
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.4.1
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Strip everything but punctuation from a field and store the remainder in
74
+ a separate field. This is often used for fingerprinting log events.
75
+ test_files:
76
+ - spec/filters/punct.rb