logstash-input-tcp 1.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +5 -0
 - data/README.md +4 -4
 - data/lib/logstash/inputs/tcp.rb +132 -113
 - data/logstash-input-tcp.gemspec +3 -3
 - data/spec/inputs/tcp_spec.rb +57 -27
 - data/spec/spec_helper.rb +27 -0
 - metadata +27 -27
 - data/.gitignore +0 -4
 - data/Rakefile +0 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9e352517c189ba1a2460edd52b98462fc357b71a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 74dfb043adfd5d70b171668d053d5391fe6edf2a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 64db2174f3750b2ab0968264f25843e3d791fe7e7439825a669c14a59a07b283472fb8a2fcda747159fac22770d637f65513314f3e94bda2d7b976dd74840249
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 71e3f67d9bf174aa6c38c3a9d30a54a05f395326ca0de6913653ae1d6938c221444d59126341b032c062cb36a77fc51b0f07de857c1de0650c445c06282a94c4
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -0,0 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## 2.0.0
         
     | 
| 
      
 2 
     | 
    
         
            +
             - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully, 
         
     | 
| 
      
 3 
     | 
    
         
            +
               instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
         
     | 
| 
      
 4 
     | 
    
         
            +
             - Dependency on logstash-core update to 2.0
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Logstash Plugin
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            This is a plugin for [Logstash](https://github.com/ 
     | 
| 
      
 3 
     | 
    
         
            +
            This is a plugin for [Logstash](https://github.com/elastic/logstash).
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            ## Documentation
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
            Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www. 
     | 
| 
      
 9 
     | 
    
         
            +
            Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
         
     | 
| 
       12 
     | 
    
         
            -
            - For more asciidoc formatting tips, see the excellent reference here https://github.com/ 
     | 
| 
      
 12 
     | 
    
         
            +
            - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            ## Need Help?
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
         @@ -83,4 +83,4 @@ Programming is not a required skill. Whatever you've seen about open source and 
     | 
|
| 
       83 
83 
     | 
    
         | 
| 
       84 
84 
     | 
    
         
             
            It is more important to the community that you are able to contribute.
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
       86 
     | 
    
         
            -
            For more information about contributing, see the [CONTRIBUTING](https://github.com/ 
     | 
| 
      
 86 
     | 
    
         
            +
            For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
         
     | 
    
        data/lib/logstash/inputs/tcp.rb
    CHANGED
    
    | 
         @@ -1,6 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: utf-8
         
     | 
| 
       2 
2 
     | 
    
         
             
            require "logstash/inputs/base"
         
     | 
| 
       3 
     | 
    
         
            -
            require "logstash/namespace"
         
     | 
| 
       4 
3 
     | 
    
         
             
            require "logstash/util/socket_peer"
         
     | 
| 
       5 
4 
     | 
    
         | 
| 
       6 
5 
     | 
    
         
             
            # Read events over a TCP socket.
         
     | 
| 
         @@ -22,11 +21,7 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base 
     | 
|
| 
       22 
21 
     | 
    
         
             
              # When mode is `client`, the port to connect to.
         
     | 
| 
       23 
22 
     | 
    
         
             
              config :port, :validate => :number, :required => true
         
     | 
| 
       24 
23 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
               
     | 
| 
       26 
     | 
    
         
            -
              # more than this timeout period, we will assume it is dead and close it.
         
     | 
| 
       27 
     | 
    
         
            -
              #
         
     | 
| 
       28 
     | 
    
         
            -
              # If you never want to timeout, use -1.
         
     | 
| 
       29 
     | 
    
         
            -
              config :data_timeout, :validate => :number, :default => -1
         
     | 
| 
      
 24 
     | 
    
         
            +
              config :data_timeout, :validate => :number, :default => -1, :deprecated => "This setting is not used by this plugin. It will be removed soon."
         
     | 
| 
       30 
25 
     | 
    
         | 
| 
       31 
26 
     | 
    
         
             
              # Mode to operate in. `server` listens for client connections,
         
     | 
| 
       32 
27 
     | 
    
         
             
              # `client` connects to a server.
         
     | 
| 
         @@ -53,12 +48,14 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base 
     | 
|
| 
       53 
48 
     | 
    
         | 
| 
       54 
49 
     | 
    
         
             
              def initialize(*args)
         
     | 
| 
       55 
50 
     | 
    
         
             
                super(*args)
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                # threadsafe socket bookkeeping
         
     | 
| 
       57 
53 
     | 
    
         
             
                @server_socket = nil
         
     | 
| 
       58 
54 
     | 
    
         
             
                @client_socket = nil
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
      
 55 
     | 
    
         
            +
                @connection_sockets = {}
         
     | 
| 
      
 56 
     | 
    
         
            +
                @socket_mutex = Mutex.new
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
       60 
58 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
              public
         
     | 
| 
       62 
59 
     | 
    
         
             
              def register
         
     | 
| 
       63 
60 
     | 
    
         
             
                require "socket"
         
     | 
| 
       64 
61 
     | 
    
         
             
                require "timeout"
         
     | 
| 
         @@ -86,49 +83,127 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base 
     | 
|
| 
       86 
83 
     | 
    
         
             
                    @ssl_context.cert_store = @cert_store
         
     | 
| 
       87 
84 
     | 
    
         
             
                    @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
         
     | 
| 
       88 
85 
     | 
    
         
             
                  end
         
     | 
| 
       89 
     | 
    
         
            -
                end 
     | 
| 
      
 86 
     | 
    
         
            +
                end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                # note that since we are opening a socket in register, we must also make sure we close it
         
     | 
| 
      
 89 
     | 
    
         
            +
                # in the close method even if we also close it in the stop method since we could have
         
     | 
| 
      
 90 
     | 
    
         
            +
                # a situation where register is called but not run & stop.
         
     | 
| 
       90 
91 
     | 
    
         | 
| 
       91 
92 
     | 
    
         
             
                if server?
         
     | 
| 
       92 
93 
     | 
    
         
             
                  @logger.info("Starting tcp input listener", :address => "#{@host}:#{@port}")
         
     | 
| 
       93 
94 
     | 
    
         
             
                  begin
         
     | 
| 
       94 
     | 
    
         
            -
                     
     | 
| 
      
 95 
     | 
    
         
            +
                    set_server_socket(TCPServer.new(@host, @port))
         
     | 
| 
       95 
96 
     | 
    
         
             
                  rescue Errno::EADDRINUSE
         
     | 
| 
       96 
97 
     | 
    
         
             
                    @logger.error("Could not start TCP server: Address in use", :host => @host, :port => @port)
         
     | 
| 
       97 
98 
     | 
    
         
             
                    raise
         
     | 
| 
       98 
99 
     | 
    
         
             
                  end
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                  set_server_socket(OpenSSL::SSL::SSLServer.new(server_socket, @ssl_context)) if @ssl_enable
         
     | 
| 
      
 102 
     | 
    
         
            +
                end
         
     | 
| 
      
 103 
     | 
    
         
            +
              end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
              def run(output_queue)
         
     | 
| 
      
 106 
     | 
    
         
            +
                if server?
         
     | 
| 
      
 107 
     | 
    
         
            +
                  run_server(output_queue)
         
     | 
| 
      
 108 
     | 
    
         
            +
                else
         
     | 
| 
      
 109 
     | 
    
         
            +
                  run_client(output_queue)
         
     | 
| 
       102 
110 
     | 
    
         
             
                end
         
     | 
| 
       103 
     | 
    
         
            -
              end 
     | 
| 
      
 111 
     | 
    
         
            +
              end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
              def stop
         
     | 
| 
      
 114 
     | 
    
         
            +
                # force close all sockets which will escape any blocking read with a IO exception
         
     | 
| 
      
 115 
     | 
    
         
            +
                # and any thread using them will exit.
         
     | 
| 
      
 116 
     | 
    
         
            +
                # catch all rescue nil on close to discard any close errors or invalid socket
         
     | 
| 
      
 117 
     | 
    
         
            +
                server_socket.close rescue nil
         
     | 
| 
      
 118 
     | 
    
         
            +
                client_socket.close rescue nil
         
     | 
| 
      
 119 
     | 
    
         
            +
                connection_sockets.each{|socket| socket.close rescue nil}
         
     | 
| 
      
 120 
     | 
    
         
            +
              end
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
              def close
         
     | 
| 
      
 123 
     | 
    
         
            +
                # see related comment in register: we must make sure to close the server socket here
         
     | 
| 
      
 124 
     | 
    
         
            +
                # because it is created in the register method and we could be in the context of having
         
     | 
| 
      
 125 
     | 
    
         
            +
                # register called but never run & stop, only close.
         
     | 
| 
      
 126 
     | 
    
         
            +
                # catch all rescue nil on close to discard any close errors or invalid socket
         
     | 
| 
      
 127 
     | 
    
         
            +
                server_socket.close rescue nil
         
     | 
| 
      
 128 
     | 
    
         
            +
              end
         
     | 
| 
       104 
129 
     | 
    
         | 
| 
       105 
130 
     | 
    
         
             
              private
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                   
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
                     
     | 
| 
       113 
     | 
    
         
            -
                   
     | 
| 
       114 
     | 
    
         
            -
                     
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
              def run_server(output_queue)
         
     | 
| 
      
 133 
     | 
    
         
            +
                while !stop?
         
     | 
| 
      
 134 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 135 
     | 
    
         
            +
                    socket = add_connection_socket(server_socket.accept)
         
     | 
| 
      
 136 
     | 
    
         
            +
                    # start a new thread for each connection.
         
     | 
| 
      
 137 
     | 
    
         
            +
                    server_connection_thread(output_queue, socket)
         
     | 
| 
      
 138 
     | 
    
         
            +
                  rescue OpenSSL::SSL::SSLError => e
         
     | 
| 
      
 139 
     | 
    
         
            +
                    @logger.error("SSL Error", :exception => e, :backtrace => e.backtrace)
         
     | 
| 
      
 140 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 141 
     | 
    
         
            +
                    # if this exception occured while the plugin is stopping
         
     | 
| 
      
 142 
     | 
    
         
            +
                    # just ignore and exit
         
     | 
| 
      
 143 
     | 
    
         
            +
                    raise unless stop?
         
     | 
| 
      
 144 
     | 
    
         
            +
                  end
         
     | 
| 
      
 145 
     | 
    
         
            +
                end
         
     | 
| 
      
 146 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 147 
     | 
    
         
            +
                # catch all rescue nil on close to discard any close errors or invalid socket
         
     | 
| 
      
 148 
     | 
    
         
            +
                server_socket.close rescue nil
         
     | 
| 
      
 149 
     | 
    
         
            +
              end
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
              def run_client(output_queue)
         
     | 
| 
      
 152 
     | 
    
         
            +
                while !stop?
         
     | 
| 
      
 153 
     | 
    
         
            +
                  set_client_socket(TCPSocket.new(@host, @port))
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
                  if @ssl_enable
         
     | 
| 
      
 156 
     | 
    
         
            +
                    set_client_socket(OpenSSL::SSL::SSLSocket.new(client_socket, @ssl_context))
         
     | 
| 
      
 157 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 158 
     | 
    
         
            +
                      client_socket.connect
         
     | 
| 
      
 159 
     | 
    
         
            +
                    rescue OpenSSL::SSL::SSLError => e
         
     | 
| 
      
 160 
     | 
    
         
            +
                      @logger.error("SSL Error", :exception => e, :backtrace => e.backtrace)
         
     | 
| 
      
 161 
     | 
    
         
            +
                      sleep(1) # prevent hammering peer
         
     | 
| 
      
 162 
     | 
    
         
            +
                      next
         
     | 
| 
      
 163 
     | 
    
         
            +
                    rescue
         
     | 
| 
      
 164 
     | 
    
         
            +
                      # if this exception occured while the plugin is stopping
         
     | 
| 
      
 165 
     | 
    
         
            +
                      # just ignore and exit
         
     | 
| 
      
 166 
     | 
    
         
            +
                      raise unless stop?
         
     | 
| 
       116 
167 
     | 
    
         
             
                    end
         
     | 
| 
       117 
168 
     | 
    
         
             
                  end
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
                  @logger.debug? && @logger.debug("Opened connection", :client => "#{client_socket.peer}")
         
     | 
| 
      
 171 
     | 
    
         
            +
                  handle_socket(client_socket, client_socket.peeraddr[3], output_queue, @codec.clone)
         
     | 
| 
      
 172 
     | 
    
         
            +
                end
         
     | 
| 
      
 173 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 174 
     | 
    
         
            +
                # catch all rescue nil on close to discard any close errors or invalid socket
         
     | 
| 
      
 175 
     | 
    
         
            +
                client_socket.close rescue nil
         
     | 
| 
      
 176 
     | 
    
         
            +
              end
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
              def server_connection_thread(output_queue, socket)
         
     | 
| 
      
 179 
     | 
    
         
            +
                Thread.new(output_queue, socket) do |q, s|
         
     | 
| 
      
 180 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 181 
     | 
    
         
            +
                    @logger.debug? && @logger.debug("Accepted connection", :client => s.peer, :server => "#{@host}:#{@port}")
         
     | 
| 
      
 182 
     | 
    
         
            +
                    handle_socket(s, s.peeraddr[3], q, @codec.clone)
         
     | 
| 
      
 183 
     | 
    
         
            +
                  ensure
         
     | 
| 
      
 184 
     | 
    
         
            +
                    delete_connection_socket(s)
         
     | 
| 
      
 185 
     | 
    
         
            +
                  end
         
     | 
| 
      
 186 
     | 
    
         
            +
                end
         
     | 
| 
      
 187 
     | 
    
         
            +
              end
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
              def handle_socket(socket, client_address, output_queue, codec)
         
     | 
| 
      
 190 
     | 
    
         
            +
                while !stop?
         
     | 
| 
      
 191 
     | 
    
         
            +
                  codec.decode(read(socket)) do |event|
         
     | 
| 
       119 
192 
     | 
    
         
             
                    event["host"] ||= client_address
         
     | 
| 
       120 
193 
     | 
    
         
             
                    event["sslsubject"] ||= socket.peer_cert.subject if @ssl_enable && @ssl_verify
         
     | 
| 
       121 
194 
     | 
    
         
             
                    decorate(event)
         
     | 
| 
       122 
195 
     | 
    
         
             
                    output_queue << event
         
     | 
| 
       123 
196 
     | 
    
         
             
                  end
         
     | 
| 
       124 
     | 
    
         
            -
                end 
     | 
| 
      
 197 
     | 
    
         
            +
                end
         
     | 
| 
       125 
198 
     | 
    
         
             
              rescue EOFError
         
     | 
| 
       126 
199 
     | 
    
         
             
                @logger.debug? && @logger.debug("Connection closed", :client => socket.peer)
         
     | 
| 
       127 
200 
     | 
    
         
             
              rescue Errno::ECONNRESET
         
     | 
| 
       128 
201 
     | 
    
         
             
                @logger.debug? && @logger.debug("Connection reset by peer", :client => socket.peer)
         
     | 
| 
       129 
202 
     | 
    
         
             
              rescue => e
         
     | 
| 
       130 
     | 
    
         
            -
                 
     | 
| 
      
 203 
     | 
    
         
            +
                # if plugin is stopping, don't bother logging it as an error
         
     | 
| 
      
 204 
     | 
    
         
            +
                @logger.error("An error occurred. Closing connection", :client => socket.peer, :exception => e, :backtrace => e.backtrace) unless stop?
         
     | 
| 
       131 
205 
     | 
    
         
             
              ensure
         
     | 
| 
      
 206 
     | 
    
         
            +
                # catch all rescue nil on close to discard any close errors or invalid socket
         
     | 
| 
       132 
207 
     | 
    
         
             
                socket.close rescue nil
         
     | 
| 
       133 
208 
     | 
    
         | 
| 
       134 
209 
     | 
    
         
             
                codec.respond_to?(:flush) && codec.flush do |event|
         
     | 
| 
         @@ -139,98 +214,42 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base 
     | 
|
| 
       139 
214 
     | 
    
         
             
                end
         
     | 
| 
       140 
215 
     | 
    
         
             
              end
         
     | 
| 
       141 
216 
     | 
    
         | 
| 
       142 
     | 
    
         
            -
              private
         
     | 
| 
       143 
     | 
    
         
            -
              def client_thread(output_queue, socket)
         
     | 
| 
       144 
     | 
    
         
            -
                Thread.new(output_queue, socket) do |q, s|
         
     | 
| 
       145 
     | 
    
         
            -
                  begin
         
     | 
| 
       146 
     | 
    
         
            -
                    @logger.debug? && @logger.debug("Accepted connection", :client => s.peer, :server => "#{@host}:#{@port}")
         
     | 
| 
       147 
     | 
    
         
            -
                    handle_socket(s, s.peeraddr[3], q, @codec.clone)
         
     | 
| 
       148 
     | 
    
         
            -
                  rescue LogStash::ShutdownSignal
         
     | 
| 
       149 
     | 
    
         
            -
                    @interrupted = true
         
     | 
| 
       150 
     | 
    
         
            -
                    s.close rescue nil
         
     | 
| 
       151 
     | 
    
         
            -
                  ensure
         
     | 
| 
       152 
     | 
    
         
            -
                    @client_threads_lock.synchronize{@client_threads.delete(Thread.current)}
         
     | 
| 
       153 
     | 
    
         
            -
                  end
         
     | 
| 
       154 
     | 
    
         
            -
                end
         
     | 
| 
       155 
     | 
    
         
            -
              end
         
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
              private
         
     | 
| 
       158 
217 
     | 
    
         
             
              def server?
         
     | 
| 
       159 
218 
     | 
    
         
             
                @mode == "server"
         
     | 
| 
       160 
     | 
    
         
            -
              end 
     | 
| 
      
 219 
     | 
    
         
            +
              end
         
     | 
| 
       161 
220 
     | 
    
         | 
| 
       162 
     | 
    
         
            -
              private
         
     | 
| 
       163 
221 
     | 
    
         
             
              def read(socket)
         
     | 
| 
       164 
222 
     | 
    
         
             
                socket.sysread(16384)
         
     | 
| 
       165 
     | 
    
         
            -
              end 
     | 
| 
      
 223 
     | 
    
         
            +
              end
         
     | 
| 
       166 
224 
     | 
    
         | 
| 
       167 
     | 
    
         
            -
               
     | 
| 
       168 
     | 
    
         
            -
              def run(output_queue)
         
     | 
| 
       169 
     | 
    
         
            -
                if server?
         
     | 
| 
       170 
     | 
    
         
            -
                  run_server(output_queue)
         
     | 
| 
       171 
     | 
    
         
            -
                else
         
     | 
| 
       172 
     | 
    
         
            -
                  run_client(output_queue)
         
     | 
| 
       173 
     | 
    
         
            -
                end
         
     | 
| 
       174 
     | 
    
         
            -
              end # def run
         
     | 
| 
      
 225 
     | 
    
         
            +
              # threadsafe sockets bookkeeping
         
     | 
| 
       175 
226 
     | 
    
         | 
| 
       176 
     | 
    
         
            -
              def  
     | 
| 
       177 
     | 
    
         
            -
                @ 
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
      
 227 
     | 
    
         
            +
              def set_client_socket(socket)
         
     | 
| 
      
 228 
     | 
    
         
            +
                @socket_mutex.synchronize{@client_socket = socket}
         
     | 
| 
      
 229 
     | 
    
         
            +
              end
         
     | 
| 
       179 
230 
     | 
    
         | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
                    # start a new thread for each connection.
         
     | 
| 
       184 
     | 
    
         
            -
                    @client_threads_lock.synchronize{@client_threads << client_thread(output_queue, socket)}
         
     | 
| 
       185 
     | 
    
         
            -
                  rescue OpenSSL::SSL::SSLError => ssle
         
     | 
| 
       186 
     | 
    
         
            -
                    # NOTE(mrichar1): This doesn't return a useful error message for some reason
         
     | 
| 
       187 
     | 
    
         
            -
                    @logger.error("SSL Error", :exception => ssle, :backtrace => ssle.backtrace)
         
     | 
| 
       188 
     | 
    
         
            -
                  rescue IOError
         
     | 
| 
       189 
     | 
    
         
            -
                    raise unless @interrupted
         
     | 
| 
       190 
     | 
    
         
            -
                  end
         
     | 
| 
       191 
     | 
    
         
            -
                end
         
     | 
| 
       192 
     | 
    
         
            -
              rescue LogStash::ShutdownSignal
         
     | 
| 
       193 
     | 
    
         
            -
                @interrupted = true
         
     | 
| 
       194 
     | 
    
         
            -
              ensure
         
     | 
| 
       195 
     | 
    
         
            -
                @server_socket.close rescue nil
         
     | 
| 
      
 231 
     | 
    
         
            +
              def client_socket
         
     | 
| 
      
 232 
     | 
    
         
            +
                @socket_mutex.synchronize{@client_socket}
         
     | 
| 
      
 233 
     | 
    
         
            +
              end
         
     | 
| 
       196 
234 
     | 
    
         | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
                 
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
                end
         
     | 
| 
       201 
     | 
    
         
            -
              end # def run_server
         
     | 
| 
      
 235 
     | 
    
         
            +
              def set_server_socket(socket)
         
     | 
| 
      
 236 
     | 
    
         
            +
                @socket_mutex.synchronize{@server_socket = socket}
         
     | 
| 
      
 237 
     | 
    
         
            +
              end
         
     | 
| 
       202 
238 
     | 
    
         | 
| 
       203 
     | 
    
         
            -
              def  
     | 
| 
       204 
     | 
    
         
            -
                 
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
       217 
     | 
    
         
            -
             
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
              ensure
         
     | 
| 
       221 
     | 
    
         
            -
                @client_socket.close rescue nil
         
     | 
| 
       222 
     | 
    
         
            -
              end # def run
         
     | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
       224 
     | 
    
         
            -
              public
         
     | 
| 
       225 
     | 
    
         
            -
              def teardown
         
     | 
| 
       226 
     | 
    
         
            -
                @interrupted = true
         
     | 
| 
       227 
     | 
    
         
            -
                if @server_socket
         
     | 
| 
       228 
     | 
    
         
            -
                  @server_socket.close rescue nil
         
     | 
| 
       229 
     | 
    
         
            -
                  @server_socket = nil
         
     | 
| 
       230 
     | 
    
         
            -
                end
         
     | 
| 
       231 
     | 
    
         
            -
                if @client_socket
         
     | 
| 
       232 
     | 
    
         
            -
                  @client_socket.close rescue nil
         
     | 
| 
       233 
     | 
    
         
            -
                  @client_socket = nil
         
     | 
| 
       234 
     | 
    
         
            -
                end
         
     | 
| 
       235 
     | 
    
         
            -
              end # def teardown
         
     | 
| 
       236 
     | 
    
         
            -
            end # class LogStash::Inputs::Tcp
         
     | 
| 
      
 239 
     | 
    
         
            +
              def server_socket
         
     | 
| 
      
 240 
     | 
    
         
            +
                @socket_mutex.synchronize{@server_socket}
         
     | 
| 
      
 241 
     | 
    
         
            +
              end
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
              def add_connection_socket(socket)
         
     | 
| 
      
 244 
     | 
    
         
            +
                @socket_mutex.synchronize{@connection_sockets[socket] = true}
         
     | 
| 
      
 245 
     | 
    
         
            +
                socket
         
     | 
| 
      
 246 
     | 
    
         
            +
              end
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
      
 248 
     | 
    
         
            +
              def delete_connection_socket(socket)
         
     | 
| 
      
 249 
     | 
    
         
            +
                @socket_mutex.synchronize{@connection_sockets.delete(socket)}
         
     | 
| 
      
 250 
     | 
    
         
            +
              end
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
              def connection_sockets
         
     | 
| 
      
 253 
     | 
    
         
            +
                @socket_mutex.synchronize{@connection_sockets.keys.dup}
         
     | 
| 
      
 254 
     | 
    
         
            +
              end
         
     | 
| 
      
 255 
     | 
    
         
            +
            end
         
     | 
    
        data/logstash-input-tcp.gemspec
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
              s.name            = 'logstash-input-tcp'
         
     | 
| 
       4 
     | 
    
         
            -
              s.version         = ' 
     | 
| 
      
 4 
     | 
    
         
            +
              s.version         = '2.0.1'
         
     | 
| 
       5 
5 
     | 
    
         
             
              s.licenses        = ['Apache License (2.0)']
         
     | 
| 
       6 
6 
     | 
    
         
             
              s.summary         = "Read 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"
         
     | 
| 
         @@ -11,7 +11,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       11 
11 
     | 
    
         
             
              s.require_paths = ["lib"]
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
              # Files
         
     | 
| 
       14 
     | 
    
         
            -
              s.files =  
     | 
| 
      
 14 
     | 
    
         
            +
              s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              # Tests
         
     | 
| 
       17 
17 
     | 
    
         
             
              s.test_files = s.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
         @@ -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-core",  
     | 
| 
      
 23 
     | 
    
         
            +
              s.add_runtime_dependency "logstash-core", ">= 2.0.0.snapshot", "< 3.0.0"
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
              s.add_runtime_dependency 'logstash-codec-plain'
         
     | 
| 
       26 
26 
     | 
    
         
             
              s.add_runtime_dependency 'logstash-codec-line'
         
     | 
    
        data/spec/inputs/tcp_spec.rb
    CHANGED
    
    | 
         @@ -5,10 +5,10 @@ require "timeout" 
     | 
|
| 
       5 
5 
     | 
    
         
             
            require "logstash/json"
         
     | 
| 
       6 
6 
     | 
    
         
             
            require "logstash/inputs/tcp"
         
     | 
| 
       7 
7 
     | 
    
         
             
            require 'stud/try'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative "../spec_helper"
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
            describe LogStash::Inputs::Tcp do
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
12 
     | 
    
         
             
              context "codec (PR #1372)" do
         
     | 
| 
       13 
13 
     | 
    
         
             
                it "switches from plain to line" do
         
     | 
| 
       14 
14 
     | 
    
         
             
                  require "logstash/codecs/plain"
         
     | 
| 
         @@ -16,7 +16,7 @@ describe LogStash::Inputs::Tcp do 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  plugin = LogStash::Inputs::Tcp.new("codec" => LogStash::Codecs::Plain.new, "port" => 0)
         
     | 
| 
       17 
17 
     | 
    
         
             
                  plugin.register
         
     | 
| 
       18 
18 
     | 
    
         
             
                  insist { plugin.codec }.is_a?(LogStash::Codecs::Line)
         
     | 
| 
       19 
     | 
    
         
            -
                  plugin. 
     | 
| 
      
 19 
     | 
    
         
            +
                  plugin.close
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
21 
     | 
    
         
             
                it "switches from json to json_lines" do
         
     | 
| 
       22 
22 
     | 
    
         
             
                  require "logstash/codecs/json"
         
     | 
| 
         @@ -24,7 +24,7 @@ describe LogStash::Inputs::Tcp do 
     | 
|
| 
       24 
24 
     | 
    
         
             
                  plugin = LogStash::Inputs::Tcp.new("codec" => LogStash::Codecs::JSON.new, "port" => 0)
         
     | 
| 
       25 
25 
     | 
    
         
             
                  plugin.register
         
     | 
| 
       26 
26 
     | 
    
         
             
                  insist { plugin.codec }.is_a?(LogStash::Codecs::JSONLines)
         
     | 
| 
       27 
     | 
    
         
            -
                  plugin. 
     | 
| 
      
 27 
     | 
    
         
            +
                  plugin.close
         
     | 
| 
       28 
28 
     | 
    
         
             
                end
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
         @@ -39,8 +39,6 @@ describe LogStash::Inputs::Tcp do 
     | 
|
| 
       39 
39 
     | 
    
         
             
                  }
         
     | 
| 
       40 
40 
     | 
    
         
             
                CONFIG
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
42 
     | 
    
         
             
                events = input(conf) do |pipeline, queue|
         
     | 
| 
       45 
43 
     | 
    
         
             
                  socket = Stud::try(5.times) { TCPSocket.new("127.0.0.1", port) }
         
     | 
| 
       46 
44 
     | 
    
         
             
                  event_count.times do |i|
         
     | 
| 
         @@ -214,35 +212,67 @@ describe LogStash::Inputs::Tcp do 
     | 
|
| 
       214 
212 
     | 
    
         
             
                end
         
     | 
| 
       215 
213 
     | 
    
         
             
              end
         
     | 
| 
       216 
214 
     | 
    
         | 
| 
       217 
     | 
    
         
            -
               
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
             
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
       224 
     | 
    
         
            -
                    }
         
     | 
| 
       225 
     | 
    
         
            -
                  }
         
     | 
| 
       226 
     | 
    
         
            -
                CONFIG
         
     | 
| 
      
 215 
     | 
    
         
            +
              # below are new specs added in the context of the shutdown semantic refactor.
         
     | 
| 
      
 216 
     | 
    
         
            +
              # TODO:
         
     | 
| 
      
 217 
     | 
    
         
            +
              #   - refactor all specs using this new model
         
     | 
| 
      
 218 
     | 
    
         
            +
              #   - pipelineless_input has been basically copied from the udp input specs, it should be DRYied up
         
     | 
| 
      
 219 
     | 
    
         
            +
              #   - see if we should miminc the udp input UDPClient helper class instead of directly using TCPSocket
         
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
      
 221 
     | 
    
         
            +
              describe "LogStash::Inputs::Tcp new specs style" do
         
     | 
| 
       227 
222 
     | 
    
         | 
| 
       228 
     | 
    
         
            -
                 
     | 
| 
       229 
     | 
    
         
            -
                   
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
      
 223 
     | 
    
         
            +
                before do
         
     | 
| 
      
 224 
     | 
    
         
            +
                  srand(RSpec.configuration.seed)
         
     | 
| 
      
 225 
     | 
    
         
            +
                end
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
      
 227 
     | 
    
         
            +
                let(:port) { rand(1024..65535) }
         
     | 
| 
      
 228 
     | 
    
         
            +
                subject { LogStash::Plugin.lookup("input", "tcp").new({ "port" => port }) }
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
                after :each do
         
     | 
| 
      
 231 
     | 
    
         
            +
                  subject.close rescue nil
         
     | 
| 
      
 232 
     | 
    
         
            +
                end
         
     | 
| 
       231 
233 
     | 
    
         | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
      
 234 
     | 
    
         
            +
                describe "register" do
         
     | 
| 
      
 235 
     | 
    
         
            +
                  it "should register without errors" do
         
     | 
| 
      
 236 
     | 
    
         
            +
                    expect { subject.register }.to_not raise_error
         
     | 
| 
      
 237 
     | 
    
         
            +
                  end
         
     | 
| 
      
 238 
     | 
    
         
            +
                end
         
     | 
| 
      
 239 
     | 
    
         
            +
             
     | 
| 
      
 240 
     | 
    
         
            +
                describe "receive" do
         
     | 
| 
      
 241 
     | 
    
         
            +
             
     | 
| 
      
 242 
     | 
    
         
            +
                  let(:nevents) { 10 }
         
     | 
| 
      
 243 
     | 
    
         
            +
             
     | 
| 
      
 244 
     | 
    
         
            +
                  let(:events) do
         
     | 
| 
       233 
245 
     | 
    
         
             
                    socket = Stud::try(5.times) { TCPSocket.new("127.0.0.1", port) }
         
     | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
       235 
     | 
    
         
            -
                     
     | 
| 
       236 
     | 
    
         
            -
             
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
      
 247 
     | 
    
         
            +
                    result = pipelineless_input(subject, nevents) do
         
     | 
| 
      
 248 
     | 
    
         
            +
                      nevents.times do |i|
         
     | 
| 
      
 249 
     | 
    
         
            +
                        socket.puts("msg #{i}")
         
     | 
| 
      
 250 
     | 
    
         
            +
                        socket.flush
         
     | 
| 
      
 251 
     | 
    
         
            +
                      end
         
     | 
| 
      
 252 
     | 
    
         
            +
                    end
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
                    socket.close rescue nil
         
     | 
| 
      
 255 
     | 
    
         
            +
             
     | 
| 
      
 256 
     | 
    
         
            +
                    result
         
     | 
| 
       237 
257 
     | 
    
         
             
                  end
         
     | 
| 
       238 
258 
     | 
    
         | 
| 
       239 
     | 
    
         
            -
                   
     | 
| 
      
 259 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 260 
     | 
    
         
            +
                    subject.register
         
     | 
| 
      
 261 
     | 
    
         
            +
                  end
         
     | 
| 
       240 
262 
     | 
    
         | 
| 
       241 
     | 
    
         
            -
                   
     | 
| 
       242 
     | 
    
         
            -
             
     | 
| 
      
 263 
     | 
    
         
            +
                  it "should receive events been generated" do
         
     | 
| 
      
 264 
     | 
    
         
            +
                    expect(events.size).to be(nevents)
         
     | 
| 
      
 265 
     | 
    
         
            +
                    messages = events.map { |event| event["message"]}
         
     | 
| 
      
 266 
     | 
    
         
            +
                    messages.each do |message|
         
     | 
| 
      
 267 
     | 
    
         
            +
                      expect(message).to match(/msg \d+/)
         
     | 
| 
      
 268 
     | 
    
         
            +
                    end
         
     | 
| 
      
 269 
     | 
    
         
            +
                  end
         
     | 
| 
       243 
270 
     | 
    
         | 
| 
       244 
     | 
    
         
            -
             
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
      
 271 
     | 
    
         
            +
                end
         
     | 
| 
      
 272 
     | 
    
         
            +
             
     | 
| 
      
 273 
     | 
    
         
            +
                it_behaves_like "an interruptible input plugin" do
         
     | 
| 
      
 274 
     | 
    
         
            +
                  let(:config) { { "port" => port } }
         
     | 
| 
       246 
275 
     | 
    
         
             
                end
         
     | 
| 
       247 
276 
     | 
    
         
             
              end
         
     | 
| 
      
 277 
     | 
    
         
            +
             
     | 
| 
       248 
278 
     | 
    
         
             
            end
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # encoding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "logstash/devutils/rspec/spec_helper"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            # this has been taken from the udp input, it should be DRYed
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module TcpHelpers
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              def pipelineless_input(plugin, size, &block)
         
     | 
| 
      
 9 
     | 
    
         
            +
                queue = Queue.new
         
     | 
| 
      
 10 
     | 
    
         
            +
                input_thread = Thread.new do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  plugin.run(queue)
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
                block.call
         
     | 
| 
      
 14 
     | 
    
         
            +
                sleep 0.1 while queue.size != size
         
     | 
| 
      
 15 
     | 
    
         
            +
                result = nevents.times.inject([]) do |acc|
         
     | 
| 
      
 16 
     | 
    
         
            +
                  acc << queue.pop
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
                plugin.do_stop
         
     | 
| 
      
 19 
     | 
    
         
            +
                input_thread.join
         
     | 
| 
      
 20 
     | 
    
         
            +
                result
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            RSpec.configure do |c|
         
     | 
| 
      
 26 
     | 
    
         
            +
              c.include TcpHelpers
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,122 +1,121 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: logstash-input-tcp
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Elastic
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-10-08 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
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: 1.4.0
         
     | 
| 
       20 
     | 
    
         
            -
                - - <
         
     | 
| 
       21 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       22 
     | 
    
         
            -
                    version: 2.0.0
         
     | 
| 
       23 
14 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       24 
15 
     | 
    
         
             
                requirements:
         
     | 
| 
       25 
16 
     | 
    
         
             
                - - '>='
         
     | 
| 
       26 
17 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       27 
     | 
    
         
            -
                    version:  
     | 
| 
      
 18 
     | 
    
         
            +
                    version: 2.0.0.snapshot
         
     | 
| 
       28 
19 
     | 
    
         
             
                - - <
         
     | 
| 
       29 
20 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       30 
     | 
    
         
            -
                    version:  
     | 
| 
      
 21 
     | 
    
         
            +
                    version: 3.0.0
         
     | 
| 
      
 22 
     | 
    
         
            +
              name: logstash-core
         
     | 
| 
       31 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       32 
24 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       33 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       34 
     | 
    
         
            -
              name: logstash-codec-plain
         
     | 
| 
       35 
25 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       36 
26 
     | 
    
         
             
                requirements:
         
     | 
| 
       37 
27 
     | 
    
         
             
                - - '>='
         
     | 
| 
       38 
28 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       39 
     | 
    
         
            -
                    version:  
     | 
| 
      
 29 
     | 
    
         
            +
                    version: 2.0.0.snapshot
         
     | 
| 
      
 30 
     | 
    
         
            +
                - - <
         
     | 
| 
      
 31 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 32 
     | 
    
         
            +
                    version: 3.0.0
         
     | 
| 
      
 33 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       40 
34 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       41 
35 
     | 
    
         
             
                requirements:
         
     | 
| 
       42 
36 
     | 
    
         
             
                - - '>='
         
     | 
| 
       43 
37 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       44 
38 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 39 
     | 
    
         
            +
              name: logstash-codec-plain
         
     | 
| 
       45 
40 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       46 
41 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       47 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       48 
     | 
    
         
            -
              name: logstash-codec-line
         
     | 
| 
       49 
42 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       50 
43 
     | 
    
         
             
                requirements:
         
     | 
| 
       51 
44 
     | 
    
         
             
                - - '>='
         
     | 
| 
       52 
45 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       53 
46 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 47 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       54 
48 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       55 
49 
     | 
    
         
             
                requirements:
         
     | 
| 
       56 
50 
     | 
    
         
             
                - - '>='
         
     | 
| 
       57 
51 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       58 
52 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 53 
     | 
    
         
            +
              name: logstash-codec-line
         
     | 
| 
       59 
54 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       60 
55 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       61 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       62 
     | 
    
         
            -
              name: logstash-codec-json
         
     | 
| 
       63 
56 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       64 
57 
     | 
    
         
             
                requirements:
         
     | 
| 
       65 
58 
     | 
    
         
             
                - - '>='
         
     | 
| 
       66 
59 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       67 
60 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 61 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       68 
62 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       69 
63 
     | 
    
         
             
                requirements:
         
     | 
| 
       70 
64 
     | 
    
         
             
                - - '>='
         
     | 
| 
       71 
65 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       72 
66 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 67 
     | 
    
         
            +
              name: logstash-codec-json
         
     | 
| 
       73 
68 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       74 
69 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       75 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       76 
     | 
    
         
            -
              name: logstash-codec-json_lines
         
     | 
| 
       77 
70 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       78 
71 
     | 
    
         
             
                requirements:
         
     | 
| 
       79 
72 
     | 
    
         
             
                - - '>='
         
     | 
| 
       80 
73 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       81 
74 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 75 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       82 
76 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       83 
77 
     | 
    
         
             
                requirements:
         
     | 
| 
       84 
78 
     | 
    
         
             
                - - '>='
         
     | 
| 
       85 
79 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       86 
80 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 81 
     | 
    
         
            +
              name: logstash-codec-json_lines
         
     | 
| 
       87 
82 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       88 
83 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       89 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       90 
     | 
    
         
            -
              name: logstash-devutils
         
     | 
| 
       91 
84 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       92 
85 
     | 
    
         
             
                requirements:
         
     | 
| 
       93 
86 
     | 
    
         
             
                - - '>='
         
     | 
| 
       94 
87 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       95 
88 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 89 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       96 
90 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       97 
91 
     | 
    
         
             
                requirements:
         
     | 
| 
       98 
92 
     | 
    
         
             
                - - '>='
         
     | 
| 
       99 
93 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       100 
94 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 95 
     | 
    
         
            +
              name: logstash-devutils
         
     | 
| 
       101 
96 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       102 
97 
     | 
    
         
             
              type: :development
         
     | 
| 
      
 98 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 99 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 100 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 101 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 102 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       103 
103 
     | 
    
         
             
            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
         
     | 
| 
       104 
104 
     | 
    
         
             
            email: info@elastic.co
         
     | 
| 
       105 
105 
     | 
    
         
             
            executables: []
         
     | 
| 
       106 
106 
     | 
    
         
             
            extensions: []
         
     | 
| 
       107 
107 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       108 
108 
     | 
    
         
             
            files:
         
     | 
| 
       109 
     | 
    
         
            -
            - .gitignore
         
     | 
| 
       110 
109 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
       111 
110 
     | 
    
         
             
            - CONTRIBUTORS
         
     | 
| 
       112 
111 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       113 
112 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       114 
113 
     | 
    
         
             
            - NOTICE.TXT
         
     | 
| 
       115 
114 
     | 
    
         
             
            - README.md
         
     | 
| 
       116 
     | 
    
         
            -
            - Rakefile
         
     | 
| 
       117 
115 
     | 
    
         
             
            - lib/logstash/inputs/tcp.rb
         
     | 
| 
       118 
116 
     | 
    
         
             
            - logstash-input-tcp.gemspec
         
     | 
| 
       119 
117 
     | 
    
         
             
            - spec/inputs/tcp_spec.rb
         
     | 
| 
      
 118 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
       120 
119 
     | 
    
         
             
            homepage: http://www.elastic.co/guide/en/logstash/current/index.html
         
     | 
| 
       121 
120 
     | 
    
         
             
            licenses:
         
     | 
| 
       122 
121 
     | 
    
         
             
            - Apache License (2.0)
         
     | 
| 
         @@ -139,9 +138,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       139 
138 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       140 
139 
     | 
    
         
             
            requirements: []
         
     | 
| 
       141 
140 
     | 
    
         
             
            rubyforge_project:
         
     | 
| 
       142 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 141 
     | 
    
         
            +
            rubygems_version: 2.4.8
         
     | 
| 
       143 
142 
     | 
    
         
             
            signing_key:
         
     | 
| 
       144 
143 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       145 
144 
     | 
    
         
             
            summary: Read events over a TCP socket.
         
     | 
| 
       146 
145 
     | 
    
         
             
            test_files:
         
     | 
| 
       147 
146 
     | 
    
         
             
            - spec/inputs/tcp_spec.rb
         
     | 
| 
      
 147 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
    
        data/.gitignore
    DELETED