logstash-output-logentries 0.1.0

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: 07680da9b38fd502e665e0eb0b7ebb5b6016241b
4
+ data.tar.gz: ce5bf682985477a0b8a0275456b810c11de4e586
5
+ SHA512:
6
+ metadata.gz: 2a26e20bfdbe720f6a3029d4e0de2af3b3509515fc76c1436435f5d0041ed0b6e89819af995651a19cd255f3a320090520f1c6eff7a61cdff7ec9262bb3dacca
7
+ data.tar.gz: 1a11078dbab48677d392445adebb0ce31b80c11d7b5f6e68cfa4f5c09ef144e327afb1d88b93eaed9d0bc34617eab593f3ac6c403bfb0de94e3f872707c5abb3
data/.bundle/config ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_BIN: bin
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
+ @author Logentries
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+ gem "logstash", :github => "elasticsearch/logstash", :branch => "1.5"
4
+
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012-2015 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/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Logentries - Logstash Output Plugin
2
+
3
+ This is a plugin for [Logentries](https://www.logentries.com) and Logstash.
4
+
5
+ # Send logs using token
6
+ You can forward logs from Logstash to Legentries using unique token. To do this you have to configure the output sectin of your .conf file in your logstash main folder.
7
+
8
+ output {
9
+ logentries{
10
+ token => "LOGENTRIES_TOKEN"
11
+ }
12
+ }
13
+
14
+ Please refer to this [blog](link here) for more information and instruction on how to set up your .config file.
15
+
16
+ # Legentries Token
17
+
18
+ You can find the instructions about Token based input [here](https://logentries.com/doc/input-token/)
19
+
20
+
21
+ ## Need Help?
22
+
23
+ Try #logstash on freenode IRC or the logstash-users@googlegroups.com mailing
24
+
25
+ You can also refer to [Logentries DOCs](https://logentries.com/doc/)
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,65 @@
1
+ require "logstash/outputs/base"
2
+ require "logstash/namespace"
3
+ require "uri"
4
+ require "net/http"
5
+ require "net/https"
6
+
7
+
8
+
9
+ class LogStash::Outputs::Logentries < LogStash::Outputs::Base
10
+ config_name "logentries"
11
+ milestone 2
12
+
13
+ # www.logentries.com
14
+ #
15
+ # You will read this token from your config file. Just put the following lines to your .config file:
16
+ #
17
+ # output {
18
+ # logentries{
19
+ # token => "LOGENTRIES_TOKEN"
20
+ # }
21
+ # }
22
+
23
+ config :token, :validate => :string, :required => true
24
+
25
+ public
26
+ def register
27
+ end
28
+
29
+ def receive(event)
30
+ return unless output?(event)
31
+
32
+ if event == LogStash::SHUTDOWN
33
+ finished
34
+ return
35
+ end
36
+
37
+ # Send the event using token
38
+ url = URI.parse("https://js.logentries.com/v1/logs/#{event.sprintf(@token)}")
39
+
40
+ # Debug the URL here
41
+ @logger.info("Sending using #{event.sprintf(@token)} Logentries Token")
42
+
43
+ # Open HTTP connection
44
+ http = Net::HTTP.new(url.host, url.port)
45
+
46
+ # Use secure SSL
47
+ if url.scheme == 'https'
48
+ http.use_ssl = true
49
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
50
+ end
51
+
52
+ request = Net::HTTP::Post.new(url.path)
53
+
54
+ #Prepend the message body with "event" to allow the js.logentries to pick it up
55
+ request.body = "{\"event\":" + event.to_json + "}"
56
+ response = http.request(request)
57
+
58
+ if response.is_a?(Net::HTTPSuccess)
59
+ @logger.info("Event Sent!")
60
+ else
61
+ @logger.warn("HTTP error", :error => response.error!)
62
+ end
63
+
64
+ end # receive
65
+ end #LogStash::Outputs::Logentries
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |s|
2
+
3
+ s.name = 'logstash-output-logentries'
4
+ s.version = '0.1.0'
5
+ s.licenses = ['Apache License (2.0)']
6
+ s.summary = "You can forward logs from Logstash to Legentries using unique token."
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 = ["Logentries - Bart Siniarski"]
9
+ s.email = 'info@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($\)+::Dir.glob('vendor/*')
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" => "output" }
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
@@ -0,0 +1,2 @@
1
+ require "logstash/devutils/rspec/spec_helper"
2
+
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-output-logentries
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Logentries - Bart Siniarski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logstash
15
+ requirement: !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
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.4.0
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: logstash-devutils
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ description: This gem is a logstash plugin required to be installed on top of the
48
+ Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not
49
+ a stand-alone program
50
+ email: info@elasticsearch.com
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .bundle/config
56
+ - CONTRIBUTORS
57
+ - DEVELOPER.md
58
+ - Gemfile
59
+ - LICENSE
60
+ - README.md
61
+ - Rakefile
62
+ - lib/logstash/outputs/logentries.rb
63
+ - logstash-output-logentries.gemspec
64
+ - spec/outputs/logentries_spec.rb
65
+ homepage: http://www.elasticsearch.org/guide/en/logstash/current/index.html
66
+ licenses:
67
+ - Apache License (2.0)
68
+ metadata:
69
+ logstash_plugin: 'true'
70
+ logstash_group: output
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.2.2
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: You can forward logs from Logstash to Legentries using unique token.
91
+ test_files:
92
+ - spec/outputs/logentries_spec.rb