logstash-codec-s3plain 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7adacaec47f890bf50fca28cb71e1258fc2b157b
4
+ data.tar.gz: c12a34a4bb680338262a735fa32e77d34d404288
5
+ SHA512:
6
+ metadata.gz: c76e619bb7f3e8015a2c0d19e4e0311c925ddc429fcf3cbd6b5a5b899db01d9775fc31f5eaed27a2c86efa65075b998244696ad930bb6d29f37d135bb7c215da
7
+ data.tar.gz: 9e5c750fb5afa264f6e0693d50eea371df126ddbd6f340a87b5e5ce0f015afdefb501125d3dcd138514ffdac7fcc7982fff0e4c503c468b374caec339484842c
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+ gem "logstash", :github => "elasticsearch/logstash", :branch => "1.5"
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012-2014 Elasticsearch <http://www.elasticsearch.org>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ @files=[]
2
+
3
+ task :default do
4
+ system("rake -T")
5
+ end
6
+
7
+ require "logstash/devutils/rake"
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+ require "logstash/codecs/base"
3
+ require "logstash/util/charset"
4
+
5
+ # The "s3_plain" codec is used for backward compatibility with previous version of the S3 Output
6
+ #
7
+ class LogStash::Codecs::S3Plain < LogStash::Codecs::Base
8
+ config_name "s3_plain"
9
+ milestone 3
10
+
11
+ public
12
+ def decode(data)
13
+ raise RuntimeError.new("This codec is only used for backward compatibility with the previous S3 output.")
14
+ end # def decode
15
+
16
+ public
17
+ def encode(event)
18
+ if event.is_a?(LogStash::Event)
19
+
20
+ message = "Date: #{event[LogStash::Event::TIMESTAMP]}\n"
21
+ message << "Source: #{event["source"]}\n"
22
+ message << "Tags: #{Array(event["tags"]).join(', ')}\n"
23
+ message << "Fields: #{event.to_hash.inspect}\n"
24
+ message << "Message: #{event["message"]}"
25
+
26
+ @on_event.call(message)
27
+ else
28
+ @on_event.call(event.to_s)
29
+ end
30
+ end # def encode
31
+ end # class LogStash::Codecs::S3Plain
@@ -0,0 +1,27 @@
1
+ Gem::Specification.new do |s|
2
+
3
+ s.name = 'logstash-codec-s3plain'
4
+ s.version = '0.1.1'
5
+ s.licenses = ['Apache License (2.0)']
6
+ s.summary = "This codec may be used to encode (via outputs) S3plain text format, this make the S3 outputs backward comptabile with Logstash 1.4.2"
7
+ 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"
8
+ s.authors = ["Elasticsearch"]
9
+ s.email = 'richard.pijnenburg@elasticsearch.com'
10
+ s.homepage = "http://www.elasticsearch.org/guide/en/logstash/current/index.html"
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", "logstash_group" => "codec" }
21
+
22
+ # Gem dependencies
23
+ s.add_runtime_dependency 'logstash', '>= 1.4.0', '< 2.0.0'
24
+
25
+ s.add_development_dependency 'logstash-devutils'
26
+ end
27
+
@@ -0,0 +1,37 @@
1
+ require "logstash/devutils/rspec/spec_helper"
2
+ require "logstash/event"
3
+ require "logstash/codecs/s3_plain"
4
+
5
+ describe LogStash::Codecs::S3Plain do
6
+ subject { LogStash::Codecs::S3Plain.new }
7
+
8
+ describe "#encode" do
9
+ it 'should accept a nil list for the tags' do
10
+ subject.on_event do |data|
11
+ data.should match(/\nTags:\s\n/)
12
+ end
13
+
14
+ subject.encode(LogStash::Event.new)
15
+ end
16
+
17
+ it 'should accept a list of tags' do
18
+ event = LogStash::Event.new({"tags" => ["elasticsearch", "logstash", "kibana"] })
19
+
20
+ subject.on_event do |data|
21
+ data.should match(/\nTags:\selasticsearch,\slogstash,\skibana\n/)
22
+ end
23
+
24
+ subject.encode(event)
25
+ end
26
+
27
+ it "return to_s if its not LogStash::Event" do
28
+ event = {"test" => "A-B-C" }
29
+
30
+ subject.on_event do |data|
31
+ data.should == event.to_s
32
+ end
33
+
34
+ subject.encode(event)
35
+ end
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-codec-s3plain
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Elasticsearch
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logstash
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.4.0
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
23
+ requirement: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: 1.4.0
28
+ - - <
29
+ - !ruby/object:Gem::Version
30
+ version: 2.0.0
31
+ prerelease: false
32
+ type: :runtime
33
+ - !ruby/object:Gem::Dependency
34
+ name: logstash-devutils
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ prerelease: false
46
+ type: :development
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
48
+ email: richard.pijnenburg@elasticsearch.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE
56
+ - Rakefile
57
+ - lib/logstash/codecs/s3_plain.rb
58
+ - logstash-codec-s3plain.gemspec
59
+ - spec/codecs/s3_plain_spec.rb
60
+ homepage: http://www.elasticsearch.org/guide/en/logstash/current/index.html
61
+ licenses:
62
+ - Apache License (2.0)
63
+ metadata:
64
+ logstash_plugin: 'true'
65
+ logstash_group: codec
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.4.4
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: This codec may be used to encode (via outputs) S3plain text format, this make the S3 outputs backward comptabile with Logstash 1.4.2
86
+ test_files:
87
+ - spec/codecs/s3_plain_spec.rb