Skip to content

Commit

Permalink
Update for LS 5.0 (#5)
Browse files Browse the repository at this point in the history
* Review CHANGELOG format

* update for LS 5.0
  • Loading branch information
wiibaa authored and Suyog Rao committed Sep 9, 2016
1 parent 9151c10 commit 8155d90
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 30 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.gem
Gemfile.lock
.bundle
vendor
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---
sudo: false
language: ruby
cache: bundler
jdk:
- oraclejdk8
rvm:
- jruby-1.7.23
script:
- bundle exec rspec spec
- jruby-1.7.25
before_script:
- bundle exec rake vendor
script:
- bundle exec rspec spec
17 changes: 11 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# 2.0.4
- Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
# 2.0.3
- New dependency requirements for logstash-core for the 5.0 release
## 3.0.0
- breaking: Updated plugin to use new Java Event APIs

## 2.0.4
- internal,deps: Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash

## 2.0.3
- internal,deps: New dependency requirements for logstash-core for the 5.0 release

## 2.0.0
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
- internal: Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
- Dependency on logstash-core update to 2.0
- internal,deps: Dependency on logstash-core update to 2.0

17 changes: 6 additions & 11 deletions lib/logstash/filters/oui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
require "logstash/filters/base"
require "logstash/namespace"

# This example filter will replace the contents of the default
# message field with whatever you specify in the configuration.
#
# It is only intended to be used as an example.
# Logstash filter to parse OUI data from MAC addresses
class LogStash::Filters::Oui < LogStash::Filters::Base

# Setting the config_name here is required. This is how you
Expand All @@ -18,8 +15,7 @@ class LogStash::Filters::Oui < LogStash::Filters::Base
# }
#
config_name "oui"
milestone 1


# The source field to parse
config :source, :validate => :string, :default => "message"

Expand All @@ -28,22 +24,21 @@ class LogStash::Filters::Oui < LogStash::Filters::Base

public
def register
# Add instance variables
require 'oui'
end # def register

public
def filter(event)

oui = OUI.find event[@source]
oui = OUI.find event.get(@source)
if ! oui.nil?
event[@target] = Hash.new
event.set(@target, Hash.new)
oui.each do |key, value|
event[@target][key.to_s] = value
event.set("[#{@target}][#{key.to_s}]", value)
end

# filter_matched should go in the last line of our successful code
filter_matched(event)
end
end # def filter
end # class LogStash::Filters::Example
end # class LogStash::Filters::Oui
18 changes: 10 additions & 8 deletions logstash-filter-oui.gemspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
Gem::Specification.new do |s|
s.name = 'logstash-filter-oui'
s.version = '2.0.4'
s.licenses = ['Apache License (2.0)']
s.summary = "This example filter replaces the contents of the message field with the specified value."

s.name = 'logstash-filter-oui'
s.version = '3.0.0'
s.platform = 'java'
s.licenses = ['Apache-2.0']
s.summary = "Logstash filter to parse OUI data from MAC addresses"
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"
s.authors = ["Elastic"]
s.email = 'info@elastic.co'
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
s.authors = ["Elastic"]
s.email = 'info@elastic.co'
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
s.require_paths = ["lib"]

# Files
Expand All @@ -18,7 +20,7 @@ Gem::Specification.new do |s|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }

# Gem dependencies
s.add_runtime_dependency "logstash-core-plugin-api", "~> 1.0"
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
s.add_runtime_dependency 'oui-offline', '>= 1.2.6'

s.add_development_dependency 'logstash-devutils'
Expand Down
4 changes: 2 additions & 2 deletions spec/filters/oui_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
end

sample("message" => "00:50:56") do
expect(subject["oui"]).to include( "id" => 20566)
expect(subject["oui"]["organization"]).to eq("VMware, Inc.")
expect(subject.get("oui")).to include( "id" => 20566)
expect(subject.get("[oui][organization]")).to eq("VMware, Inc.")
end
end
end

0 comments on commit 8155d90

Please sign in to comment.