logstash-output-logio 1.0.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: a2d9de8a60d59514617c16bf67dbc54abca18d36
4
+ data.tar.gz: 0ffea2903c50ac15d29e590899cab2dbd23bdb88
5
+ SHA512:
6
+ metadata.gz: 524e4b74db8cb32fc624c4961ddbcb6acbe5e3dc71f1b794605403466b1ab12e070b4429687f8aa61870f907beb2c402261b8a4964a7b7143f3f879cdd493001
7
+ data.tar.gz: b93af6431c836e67f5fa6bbaf7b19c590d9727b95336e659c93e2ba6037ff1d049bca2fbe41feaedf42bbc8fb5716f73f854237cc88b06cf7950b37872e7bda5
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ Gemfile.bak
4
+ .bundle
5
+ vendor
6
+ logstash-output-logio.tar.gz
data/CHANGELOG.md ADDED
File without changes
data/CONTRIBUTORS ADDED
@@ -0,0 +1,11 @@
1
+ The following is a list of people who have contributed ideas, code, bug
2
+ reports, or in general have helped logstash along its way.
3
+
4
+ Contributors:
5
+ * Aaron Mildenstein (untergeek)
6
+ * Pier-Hugues Pellerin (ph)
7
+
8
+ Note: If you've sent us patches, bug reports, or otherwise contributed to
9
+ Logstash, and you aren't on the list above and want to be, please let us know
10
+ and we'll make sure you're here. Contributions from folks like you are what make
11
+ open source awesome.
data/DEVELOPER.md ADDED
@@ -0,0 +1,2 @@
1
+ # logstash-output-example
2
+ Example output plugin. This should help bootstrap your effort to write your own output plugin!
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012–2015 Elasticsearch <http://www.elastic.co>
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/Makefile ADDED
@@ -0,0 +1,7 @@
1
+ all: build zip
2
+
3
+ build:
4
+ gem build logstash-output-logio.gemspec
5
+
6
+ zip:
7
+ tar -zcvf logstash-output-logio.tar.gz logstash-output-logio-*.gem
data/NOTICE.TXT ADDED
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ logio output plugin
2
+
3
+ see https://github.com/msmathers/logstash/blob/develop/log.io/lib/logstash/outputs/logio.rb
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "logstash/devutils/rake"
@@ -0,0 +1,79 @@
1
+ # # encoding: utf-8
2
+ # require "logstash/outputs/base"
3
+ # require "logstash/namespace"
4
+
5
+ # # An example output that does nothing.
6
+ # class LogStash::Outputs::Example < LogStash::Outputs::Base
7
+ # config_name "example"
8
+
9
+ # public
10
+ # def register
11
+ # end # def register
12
+
13
+ # public
14
+ # def receive(event)
15
+ # return "Event received"
16
+ # end # def event
17
+ # end # class LogStash::Outputs::Example
18
+
19
+
20
+ require "logstash/outputs/base"
21
+ require "logstash/namespace"
22
+ require "socket"
23
+
24
+ # Log.io Output
25
+ #
26
+ # Sends events to a Log.io server over TCP.
27
+ #
28
+ # Plugin is fault tolerant. If the plugin is unable to connect to the server,
29
+ # or writes to a broken socket, it will attempt to reconnect indefinitely.
30
+ #
31
+ class LogStash::Outputs::LogIO < LogStash::Outputs::Base
32
+
33
+ config_name "logio"
34
+ default :codec, 'line'
35
+
36
+ # log.io server host
37
+ config :host, :validate => :string, :required => true
38
+
39
+ # log.io server TCP port
40
+ config :port, :validate => :number, :default => 28777
41
+
42
+ # log.io TCP message format: +log|my_stream|my_node|info|message\r\n
43
+ # |%{type} |%{@timestamp} %{source_host}
44
+ config :format, :default => "+log|%{type}|%{host}|%{@timestamp}|%{message}\r\n"
45
+
46
+ public
47
+ def register
48
+ connect
49
+ end
50
+
51
+ public
52
+ def receive(event)
53
+ return unless output?(event)
54
+ msg = event.sprintf(@format)
55
+ send_log(msg)
56
+ end
57
+
58
+ private
59
+ def connect
60
+ begin
61
+ @sock = TCPSocket.open(@host, @port)
62
+ rescue
63
+ @logger.error("LOGIO: Failed to connect to Log.io server, attempting to reconnect")
64
+ sleep(2)
65
+ connect
66
+ end
67
+ end
68
+
69
+ private
70
+ def send_log(msg)
71
+ begin
72
+ @sock.puts msg
73
+ rescue
74
+ @logger.error("LOGIO: Failed to send line to Log.io server, attempting to reconnect")
75
+ sleep(2)
76
+ connect
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,24 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'logstash-output-logio'
3
+ s.version = "1.0.1"
4
+ s.licenses = ["Apache License (2.0)"]
5
+ s.summary = "log.io output support"
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"
7
+ s.authors = ["Elastic"]
8
+ s.email = "info@elastic.co"
9
+ s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
10
+ s.require_paths = ["lib"]
11
+
12
+ # Files
13
+ s.files = `git ls-files`.split($\)
14
+ # Tests
15
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
+
17
+ # Special flag to let us know this is actually a logstash plugin
18
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
19
+
20
+ # Gem dependencies
21
+ s.add_runtime_dependency "logstash-core", ">= 2.0.0.beta2", "< 3.0.0"
22
+ s.add_runtime_dependency "logstash-codec-plain"
23
+ s.add_development_dependency "logstash-devutils"
24
+ end
@@ -0,0 +1,21 @@
1
+ require "logstash/devutils/rspec/spec_helper"
2
+ require "logstash/outputs/logio"
3
+ require "logstash/codecs/plain"
4
+ require "logstash/event"
5
+
6
+ describe LogStash::Outputs::LogIO do
7
+ let(:sample_event) { LogStash::Event.new }
8
+ let(:output) { LogStash::Outputs::LogIO.new }
9
+
10
+ before do
11
+ output.register
12
+ end
13
+
14
+ describe "receive message" do
15
+ subject { output.receive(sample_event) }
16
+
17
+ it "returns a string" do
18
+ expect(subject).to eq("Event received")
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-output-logio
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Elastic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logstash-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.0.beta2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.0.beta2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: logstash-codec-plain
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: logstash-devutils
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: This gem is a logstash plugin required to be installed on top of the
62
+ Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not
63
+ a stand-alone program
64
+ email: info@elastic.co
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - ".gitignore"
70
+ - CHANGELOG.md
71
+ - CONTRIBUTORS
72
+ - DEVELOPER.md
73
+ - Gemfile
74
+ - LICENSE
75
+ - Makefile
76
+ - NOTICE.TXT
77
+ - README.md
78
+ - Rakefile
79
+ - lib/logstash/outputs/logio.rb
80
+ - logstash-output-logio.gemspec
81
+ - spec/outputs/example_spec.rb
82
+ homepage: http://www.elastic.co/guide/en/logstash/current/index.html
83
+ licenses:
84
+ - Apache License (2.0)
85
+ metadata:
86
+ logstash_plugin: 'true'
87
+ logstash_group: output
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.5.1
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: log.io output support
108
+ test_files:
109
+ - spec/outputs/example_spec.rb