logstash-input-shutdown-on-broken-stdin 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -0
- data/README.md +30 -0
- data/lib/logstash/inputs/shutdown_on_broken_stdin.rb +20 -0
- data/logstash-input-shutdown-on-broken-stdin.gemspec +25 -0
- data/spec/inputs/shutdown_on_broken_stdin_spec.rb +8 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 19433a6f6d5d11a205a6282ae2a8153ba89807f0
|
4
|
+
data.tar.gz: 857266dc9890c23eda4c3cd605604cc692cb3f7a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4882559650d90e1008028007c5cd761b67869f3ffab28064fd15dc20115aa67dcd5497872977565984dbabf98a9383dd13468f7220f758952129642d72dd2a8d
|
7
|
+
data.tar.gz: 65dd00abf9ac4313c2bcc5985fba705ee93bc084197bb6248a1c540b38adadf572b46087a94166c48fa600d105d080934308e90ebc046a345dc2ae13f985db94
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
This plugin will be useful when Logstash is launched via another Process (Agent). The Agent can connect to a central repository like (etcd) to get the Logstash config file. The advantage of having an Agent download the config file from a central repository is to have the updates to the config file (like Kafka brokers for example) propagated to all Logstash instances. The Agent can be managed by a supervisorctl or an inittab.
|
2
|
+
|
3
|
+
Agent would be started on the box which connects to the central config system to get the config file for Logstash and launches Logstash as a sub-process. The agent can be notified of changes from the config system which can kill Logstash and restart Logstash again. When an Agent quits for whatever reason, Logstash sub-process can be killed by using this Input plugin.
|
4
|
+
|
5
|
+
<pre><code>
|
6
|
+
input {
|
7
|
+
shutdown_on_broken_stdin {
|
8
|
+
type => "DROP"
|
9
|
+
}
|
10
|
+
|
11
|
+
kafka {
|
12
|
+
topic_id => "test"
|
13
|
+
zk_connect => "localhost:2181"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
filter {
|
18
|
+
if [type] == "DROP" {
|
19
|
+
drop {
|
20
|
+
# Drop the messages coming on "Stdin"
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
output {
|
26
|
+
stdout {
|
27
|
+
codec => rubydebug
|
28
|
+
}
|
29
|
+
}
|
30
|
+
</code></pre>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/inputs/stdin"
|
3
|
+
|
4
|
+
# This plugin can be used to exit Logstash when Logstash is lauched as a
|
5
|
+
# sub-process and the parent process dies. The sub-process should be launched
|
6
|
+
# inheriting the STDIN from the parent process and so if the parent process
|
7
|
+
# dies, this plugin would see a broken input and it would simply exit Logstash
|
8
|
+
|
9
|
+
class LogStash::Inputs::ShutdownOnBrokenStdin < LogStash::Inputs::Stdin
|
10
|
+
config_name "shutdown_on_broken_stdin"
|
11
|
+
|
12
|
+
def run(queue)
|
13
|
+
begin
|
14
|
+
super
|
15
|
+
rescue => e
|
16
|
+
puts "Detected broken Stdin. Exiting Logstash"
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'logstash-input-shutdown-on-broken-stdin'
|
3
|
+
s.version = '2.0.4'
|
4
|
+
s.licenses = ['Apache License (2.0)']
|
5
|
+
s.summary = "This is an extension of Stdin input plugin. This plugin exits Logstash on broken Stdin."
|
6
|
+
s.description = "If Logstash is launched as a sub-process, this plugin can be used to exit Logstash when the parent process exits. The parent process should launch the Logstash sub-process using Inherit on Stdin, this way when the parent process exits, the Stdin is broken which is detected by this plugin which exits Logstash"
|
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 = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
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" => "input" }
|
19
|
+
|
20
|
+
# Gem dependencies
|
21
|
+
s.add_runtime_dependency "logstash-core", ">= 2.0.0", "< 3.0.0"
|
22
|
+
s.add_runtime_dependency 'logstash-input-stdin'
|
23
|
+
|
24
|
+
s.add_development_dependency 'logstash-devutils'
|
25
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/devutils/rspec/spec_helper"
|
3
|
+
require "logstash/inputs/shutdown_on_broken_stdin"
|
4
|
+
require "logstash/inputs/stdin"
|
5
|
+
|
6
|
+
describe LogStash::Inputs::ShutdownOnBrokenStdin < LogStash::Inputs::Stdin do
|
7
|
+
# No tests as this is nothing but a LogStash::Inputs::Stdin
|
8
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-input-shutdown-on-broken-stdin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Elastic
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: logstash-core
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.0
|
20
|
+
- - <
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.0.0
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 2.0.0
|
28
|
+
- - <
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 3.0.0
|
31
|
+
prerelease: false
|
32
|
+
type: :runtime
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: logstash-input-stdin
|
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: :runtime
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: logstash-devutils
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
prerelease: false
|
60
|
+
type: :development
|
61
|
+
description: If Logstash is launched as a sub-process, this plugin can be used to exit Logstash when the parent process exits. The parent process should launch the Logstash sub-process using Inherit on Stdin, this way when the parent process exits, the Stdin is broken which is detected by this plugin which exits Logstash
|
62
|
+
email: info@elastic.co
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- Gemfile
|
68
|
+
- README.md
|
69
|
+
- lib/logstash/inputs/shutdown_on_broken_stdin.rb
|
70
|
+
- logstash-input-shutdown-on-broken-stdin.gemspec
|
71
|
+
- spec/inputs/shutdown_on_broken_stdin_spec.rb
|
72
|
+
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
73
|
+
licenses:
|
74
|
+
- Apache License (2.0)
|
75
|
+
metadata:
|
76
|
+
logstash_plugin: 'true'
|
77
|
+
logstash_group: input
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.4.5
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: This is an extension of Stdin input plugin. This plugin exits Logstash on broken Stdin.
|
98
|
+
test_files:
|
99
|
+
- spec/inputs/shutdown_on_broken_stdin_spec.rb
|