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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87e32dafcadb66269a4ee0d8991b61b7fe0d0333
4
- data.tar.gz: a2da8ba0f75d714baae04ccf84fdaca55c364198
3
+ metadata.gz: 4daad5bf47d97c935f330d39665314012f29d4c4
4
+ data.tar.gz: 9b9b9d3243d235aaebfa4637aac39e49831dfb77
5
5
  SHA512:
6
- metadata.gz: a115791e1cd8208e46c8606e658b8d089820335745251f4029f0f50714935a8cd313a25ce148ab39b4653ab72a53d804173e2d7604849469f761a3a372b52f2c
7
- data.tar.gz: d4bbdf6c9173a395b0e0aa9a652099f8f4d8d1f5464fcf48bcf9f54183f5a5d1b2f85c84b5e2ee3cdff9862ff1ea031a3a9a21f094ce0982ff99a6710db87beb
6
+ metadata.gz: be2e24f4fc87e8596104959bb5daf90935a1630a97b819b6766fe7b17cc39d2e3215fc54ec6e4e414a89bb6c8405bf8ad5edac484d0b2618ebc21ef188ff3cd2
7
+ data.tar.gz: fc21fda0864426ea5a4ecfeacb89702ee407dfcd09933d93559b5b8fb36575237ac18fcfe88201407c3a3a1c494e608c794591dd68c87f72f1d61dc4cc2e4d04
data/Gemfile CHANGED
@@ -1,2 +1,11 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
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
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012–2015 Elasticsearch <http://www.elastic.co>
1
+ Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co>
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.
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
- bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
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
- event["message"] = @message
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 = '2.0.2'
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 = "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"
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", ">= 2.0.0.beta2", "< 3.0.0"
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).to include("message")
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
@@ -1 +1,2 @@
1
+ # encoding: utf-8
1
2
  require "logstash/devutils/rspec/spec_helper"
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: 2.0.2
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: 2015-10-14 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
15
15
  requirements:
16
- - - '>='
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 2.0.0.beta2
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: 3.0.0
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 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
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: []