logstash-input-relp 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d0323291b86235dd9671fbf57aff651fb361eff
4
- data.tar.gz: a1ca8d2de0b2a9918279674dcfc366d20dbad1aa
3
+ metadata.gz: 2148057f735b2a5edb327beff5d106602dad57c9
4
+ data.tar.gz: 04537891291c2c4d367544459da01a09103ca092
5
5
  SHA512:
6
- metadata.gz: 388e5d35e7f5ed3eb7cd8f3afc2ac42ac9e4a715b73284bcd8f4801329b3692403ba755d4e33ebce84c9448383c9f57f229220d471e621dd6f501e9737f4f1d9
7
- data.tar.gz: 01ef4b813d3b301c1b3cb223811737c9d663dc78e2c525068159b9ce137963243804f93f8dcb3366d465f195e784702db6a0760eb48d6c1271df2bf1da43d8ce
6
+ metadata.gz: 2177fd80b7ed5854bdbd8c0f3709edaf11a82c78e5cd9b47af49b1ca8f3d71414732e5dec029180c46bacf2be0303d6061dfa4f59f712539b39c6927d504ec03
7
+ data.tar.gz: 5bb0e0b254571216fa0553e6e24627bc9304c54ed1b4a9e1c98e7dc14c7446c9a391e1efb854e0c34d715fae3fdf0c205f4b616b7d4a1e4793d590496d53904e
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
3
- gem "logstash", :github => "elasticsearch/logstash", :branch => "1.5"
2
+ gemspec
data/README.md CHANGED
@@ -22,7 +22,7 @@ Need help? Try #logstash on freenode IRC or the logstash-users@googlegroups.com
22
22
  #### Code
23
23
  - To get started, you'll need JRuby with the Bundler gem installed.
24
24
 
25
- - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization.
25
+ - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
26
26
 
27
27
  - Install dependencies
28
28
  ```sh
@@ -31,26 +31,15 @@ bundle install
31
31
 
32
32
  #### Test
33
33
 
34
- ```sh
35
- bundle exec rspec
36
- ```
34
+ - Update your dependencies
37
35
 
38
- The Logstash code required to run the tests/specs is specified in the `Gemfile` by the line similar to:
39
- ```ruby
40
- gem "logstash", :github => "elasticsearch/logstash", :branch => "1.5"
41
- ```
42
- To test against another version or a local Logstash, edit the `Gemfile` to specify an alternative location, for example:
43
- ```ruby
44
- gem "logstash", :github => "elasticsearch/logstash", :ref => "master"
45
- ```
46
- ```ruby
47
- gem "logstash", :path => "/your/local/logstash"
36
+ ```sh
37
+ bundle install
48
38
  ```
49
39
 
50
- Then update your dependencies and run your tests:
40
+ - Run tests
51
41
 
52
42
  ```sh
53
- bundle install
54
43
  bundle exec rspec
55
44
  ```
56
45
 
@@ -58,13 +47,13 @@ bundle exec rspec
58
47
 
59
48
  #### 2.1 Run in a local Logstash clone
60
49
 
61
- - Edit Logstash `tools/Gemfile` and add the local plugin path, for example:
50
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
62
51
  ```ruby
63
52
  gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
64
53
  ```
65
- - Update Logstash dependencies
54
+ - Install plugin
66
55
  ```sh
67
- rake vendor:gems
56
+ bin/plugin install --no-verify
68
57
  ```
69
58
  - Run Logstash with your plugin
70
59
  ```sh
@@ -74,6 +63,8 @@ At this point any modifications to the plugin code will be applied to this local
74
63
 
75
64
  #### 2.2 Run in an installed Logstash
76
65
 
66
+ You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
67
+
77
68
  - Build your plugin gem
78
69
  ```sh
79
70
  gem build logstash-filter-awesome.gemspec
@@ -90,6 +81,6 @@ All contributions are welcome: ideas, patches, documentation, bug reports, compl
90
81
 
91
82
  Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
92
83
 
93
- It is more important to me that you are able to contribute.
84
+ It is more important to the community that you are able to contribute.
94
85
 
95
- For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
86
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
@@ -65,11 +65,12 @@ class LogStash::Inputs::Relp < LogStash::Inputs::Base
65
65
  Thread.start(@relp_server.accept) do |client|
66
66
  rs = client[0]
67
67
  socket = client[1]
68
+ begin
69
+ rs.relp_setup_connection(socket)
68
70
  # monkeypatch a 'peer' method onto the socket.
69
71
  socket.instance_eval { class << self; include ::LogStash::Util::SocketPeer end }
70
72
  peer = socket.peer
71
73
  @logger.debug("Relp Connection to #{peer} created")
72
- begin
73
74
  relp_stream(rs,socket, output_queue, peer)
74
75
  rescue Relp::ConnectionClosed => e
75
76
  @logger.debug("Relp Connection to #{peer} Closed")
@@ -78,6 +79,8 @@ class LogStash::Inputs::Relp < LogStash::Inputs::Base
78
79
  #TODO: Still not happy with this, are they all warn level?
79
80
  #Will this catch everything I want it to?
80
81
  #Relp spec says to close connection on error, ensure this is the case
82
+ ensure
83
+ socket.close rescue nil
81
84
  end
82
85
  end # Thread.start
83
86
  rescue Relp::InvalidCommand,Relp::InappropriateCommand => e
@@ -10,6 +10,7 @@ class Relp#This isn't much use on its own, but gives RelpServer and RelpClient t
10
10
  class InvalidCommand < RelpError; end
11
11
  class InappropriateCommand < RelpError; end
12
12
  class ConnectionClosed < RelpError; end
13
+ class FrameReadException < RelpError; end
13
14
  class InsufficientCommands < RelpError; end
14
15
 
15
16
  def valid_command?(command)
@@ -75,8 +76,10 @@ class Relp#This isn't much use on its own, but gives RelpServer and RelpClient t
75
76
  frame['message'] = socket.read(frame['datalen'])
76
77
  end
77
78
  @logger.debug? and @logger.debug("Read frame", :frame => frame)
78
- rescue EOFError,Errno::ECONNRESET,IOError
79
+ rescue Errno::ECONNRESET
79
80
  raise ConnectionClosed
81
+ rescue EOFError,IOError
82
+ raise FrameReadException
80
83
  end
81
84
  if ! self.valid_command?(frame['command'])#TODO: is this enough to catch framing errors?
82
85
  if self.server?
@@ -120,6 +123,11 @@ class RelpServer < Relp
120
123
 
121
124
  def accept
122
125
  socket = @server.accept
126
+ @logger.debug("New socket created")
127
+ return self, socket
128
+ end
129
+
130
+ def relp_setup_connection(socket)
123
131
  frame=self.frame_read(socket)
124
132
  if frame['command'] == 'open'
125
133
  offer=Hash[*frame['message'].scan(/^(.*)=(.*)$/).flatten]
@@ -153,7 +161,6 @@ class RelpServer < Relp
153
161
  response_frame['message'] += 'relp_software=' + RelpSoftware + "\n"
154
162
  response_frame['message'] += 'commands=' + @required_relp_commands.join(',')#TODO: optional ones
155
163
  self.frame_write(socket, response_frame)
156
- return self, socket
157
164
  end
158
165
  else
159
166
  self.serverclose(socket)
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-relp'
4
- s.version = '0.1.2'
4
+ s.version = '0.1.3'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Read RELP events over a TCP socket."
7
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"
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
21
21
 
22
22
  # Gem dependencies
23
- s.add_runtime_dependency 'logstash', '>= 1.4.0', '< 2.0.0'
23
+ s.add_runtime_dependency "logstash-core", '>= 1.4.0', '< 2.0.0'
24
24
 
25
25
  s.add_runtime_dependency 'logstash-codec-plain'
26
26
  s.add_development_dependency 'logstash-devutils'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-relp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elasticsearch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-27 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -19,7 +19,7 @@ dependencies:
19
19
  - - <
20
20
  - !ruby/object:Gem::Version
21
21
  version: 2.0.0
22
- name: logstash
22
+ name: logstash-core
23
23
  prerelease: false
24
24
  type: :runtime
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.1.9
99
+ rubygems_version: 2.4.5
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Read RELP events over a TCP socket.