logstash-filter-example 2.0.2 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +10 -1
- data/LICENSE +1 -1
- data/README.md +13 -1
- data/lib/logstash/filters/example.rb +10 -5
- data/logstash-filter-example.gemspec +3 -3
- data/spec/filters/example_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- metadata +12 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4daad5bf47d97c935f330d39665314012f29d4c4
|
4
|
+
data.tar.gz: 9b9b9d3243d235aaebfa4637aac39e49831dfb77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be2e24f4fc87e8596104959bb5daf90935a1630a97b819b6766fe7b17cc39d2e3215fc54ec6e4e414a89bb6c8405bf8ad5edac484d0b2618ebc21ef188ff3cd2
|
7
|
+
data.tar.gz: fc21fda0864426ea5a4ecfeacb89702ee407dfcd09933d93559b5b8fb36575237ac18fcfe88201407c3a3a1c494e608c794591dd68c87f72f1d61dc4cc2e4d04
|
data/Gemfile
CHANGED
@@ -1,2 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
|
2
|
+
|
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
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Logstash Plugin
|
2
2
|
|
3
|
+
[![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-filter-example.svg)](https://travis-ci.org/logstash-plugins/logstash-filter-example)
|
4
|
+
|
3
5
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
4
6
|
|
5
7
|
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.
|
@@ -53,7 +55,12 @@ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
|
53
55
|
```
|
54
56
|
- Install plugin
|
55
57
|
```sh
|
58
|
+
# Logstash 2.3 and higher
|
59
|
+
bin/logstash-plugin install --no-verify
|
60
|
+
|
61
|
+
# Prior to Logstash 2.3
|
56
62
|
bin/plugin install --no-verify
|
63
|
+
|
57
64
|
```
|
58
65
|
- Run Logstash with your plugin
|
59
66
|
```sh
|
@@ -71,7 +78,12 @@ gem build logstash-filter-awesome.gemspec
|
|
71
78
|
```
|
72
79
|
- Install the plugin from the Logstash home
|
73
80
|
```sh
|
74
|
-
|
81
|
+
# Logstash 2.3 and higher
|
82
|
+
bin/logstash-plugin install --no-verify
|
83
|
+
|
84
|
+
# Prior to Logstash 2.3
|
85
|
+
bin/plugin install --no-verify
|
86
|
+
|
75
87
|
```
|
76
88
|
- Start Logstash and proceed to test the plugin
|
77
89
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require "logstash/filters/base"
|
3
3
|
require "logstash/namespace"
|
4
4
|
|
5
|
-
# This example filter will replace the contents of the default
|
5
|
+
# This example filter will replace the contents of the default
|
6
6
|
# message field with whatever you specify in the configuration.
|
7
7
|
#
|
8
8
|
# It is only intended to be used as an example.
|
@@ -18,14 +18,14 @@ class LogStash::Filters::Example < LogStash::Filters::Base
|
|
18
18
|
# }
|
19
19
|
#
|
20
20
|
config_name "example"
|
21
|
-
|
21
|
+
|
22
22
|
# Replace the message with this value.
|
23
23
|
config :message, :validate => :string, :default => "Hello World!"
|
24
|
-
|
24
|
+
|
25
25
|
|
26
26
|
public
|
27
27
|
def register
|
28
|
-
# Add instance variables
|
28
|
+
# Add instance variables
|
29
29
|
end # def register
|
30
30
|
|
31
31
|
public
|
@@ -34,7 +34,12 @@ class LogStash::Filters::Example < LogStash::Filters::Base
|
|
34
34
|
if @message
|
35
35
|
# Replace the event message with our message as configured in the
|
36
36
|
# config file.
|
37
|
-
|
37
|
+
|
38
|
+
# using the event.set API
|
39
|
+
event.set("message", @message)
|
40
|
+
# correct debugging log statement for reference
|
41
|
+
# using the event.get API
|
42
|
+
@logger.debug? && @logger.debug("Message is now: #{event.get("message")}")
|
38
43
|
end
|
39
44
|
|
40
45
|
# filter_matched should go in the last line of our successful code
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-example'
|
3
|
-
s.version = '
|
3
|
+
s.version = '3.0.1'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "This example filter replaces the contents of the message field with the specified value."
|
6
|
-
s.description
|
6
|
+
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"
|
7
7
|
s.authors = ["Elastic"]
|
8
8
|
s.email = 'info@elastic.co'
|
9
9
|
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
|
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
|
19
19
|
|
20
20
|
# Gem dependencies
|
21
|
-
s.add_runtime_dependency "logstash-core", "
|
21
|
+
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
22
22
|
s.add_development_dependency 'logstash-devutils'
|
23
23
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'spec_helper'
|
2
3
|
require "logstash/filters/example"
|
3
4
|
|
@@ -13,8 +14,7 @@ describe LogStash::Filters::Example do
|
|
13
14
|
end
|
14
15
|
|
15
16
|
sample("message" => "some text") do
|
16
|
-
expect(subject
|
17
|
-
expect(subject['message']).to eq('Hello World')
|
17
|
+
expect(subject.get("message")).to eq('Hello World')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,39 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-example
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
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
|
15
15
|
requirements:
|
16
|
-
- -
|
16
|
+
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 2.0
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.0.0
|
22
|
-
name: logstash-core
|
18
|
+
version: '2.0'
|
19
|
+
name: logstash-core-plugin-api
|
23
20
|
prerelease: false
|
24
21
|
type: :runtime
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.0.beta2
|
30
|
-
- - <
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: '2.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
35
29
|
requirements:
|
36
|
-
- -
|
30
|
+
- - ">="
|
37
31
|
- !ruby/object:Gem::Version
|
38
32
|
version: '0'
|
39
33
|
name: logstash-devutils
|
@@ -41,10 +35,10 @@ dependencies:
|
|
41
35
|
type: :development
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
|
-
- -
|
38
|
+
- - ">="
|
45
39
|
- !ruby/object:Gem::Version
|
46
40
|
version: '0'
|
47
|
-
description: This gem is a
|
41
|
+
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
|
48
42
|
email: info@elastic.co
|
49
43
|
executables: []
|
50
44
|
extensions: []
|
@@ -73,12 +67,12 @@ require_paths:
|
|
73
67
|
- lib
|
74
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
69
|
requirements:
|
76
|
-
- -
|
70
|
+
- - ">="
|
77
71
|
- !ruby/object:Gem::Version
|
78
72
|
version: '0'
|
79
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
74
|
requirements:
|
81
|
-
- -
|
75
|
+
- - ">="
|
82
76
|
- !ruby/object:Gem::Version
|
83
77
|
version: '0'
|
84
78
|
requirements: []
|