hshek-logstash-output-sumologic 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+ require "socket"
3
+
4
+ class TestServer
5
+
6
+ PORT = 5678
7
+ CRLF = "\r\n"
8
+ RESPONSE_200 = "HTTP/1.1 200 OK#{CRLF}" +
9
+ "Content-Type: text/plain#{CRLF}" +
10
+ "Content-Length: 0#{CRLF}" +
11
+ "Connection: close#{CRLF}" +
12
+ "#{CRLF}"
13
+
14
+ RESPONSE_429 = "HTTP/1.1 429 Too Many Requests#{CRLF}" +
15
+ "Content-Type: text/plain#{CRLF}" +
16
+ "Retry-After: 3600#{CRLF}" +
17
+ "#{CRLF}"
18
+
19
+ attr_reader :queue
20
+ attr_writer :response
21
+
22
+ def initialize(response = RESPONSE_200)
23
+ @requests = Queue.new()
24
+ @response = response
25
+ @server = TCPServer.new PORT
26
+ end # def initialize
27
+
28
+ def start()
29
+ @thread = Thread.new {
30
+ while session = @server.accept
31
+ request = session.gets
32
+ @requests << request
33
+ session.print @response
34
+ session.close
35
+ end
36
+ }
37
+ @thread
38
+ end # def start
39
+
40
+ def stop()
41
+ @thread.kill()
42
+ @thread.join()
43
+ end # def stop
44
+
45
+ def drain()
46
+ @requests.size.times.map { @requests.deq() }
47
+ end
48
+
49
+ end # class
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hshek-logstash-output-sumologic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Sumo Logic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-01-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: manticore
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.4
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.5.4
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: logstash-core-plugin-api
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '1.60'
40
+ - - "<="
41
+ - !ruby/object:Gem::Version
42
+ version: '2.99'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '1.60'
50
+ - - "<="
51
+ - !ruby/object:Gem::Version
52
+ version: '2.99'
53
+ - !ruby/object:Gem::Dependency
54
+ name: logstash-mixin-http_client
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '6.0'
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '6.0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: logstash-codec-plain
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: logstash-devutils
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ description: This gem is a Logstash output plugin to deliver the log or metrics to
96
+ Sumo Logic cloud service. Go to https://github.com/SumoLogic/logstash-output-sumologic
97
+ for getting help, reporting issues, etc.
98
+ email: 'collection@sumologic.com '
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - CHANGELOG.md
104
+ - DEVELOPER.md
105
+ - Gemfile
106
+ - LICENSE
107
+ - README.md
108
+ - lib/logstash/outputs/sumologic.rb
109
+ - lib/logstash/outputs/sumologic/batch.rb
110
+ - lib/logstash/outputs/sumologic/common.rb
111
+ - lib/logstash/outputs/sumologic/compressor.rb
112
+ - lib/logstash/outputs/sumologic/header_builder.rb
113
+ - lib/logstash/outputs/sumologic/message_queue.rb
114
+ - lib/logstash/outputs/sumologic/monitor.rb
115
+ - lib/logstash/outputs/sumologic/payload_builder.rb
116
+ - lib/logstash/outputs/sumologic/piler.rb
117
+ - lib/logstash/outputs/sumologic/sender.rb
118
+ - lib/logstash/outputs/sumologic/statistics.rb
119
+ - logstash-output-sumologic.gemspec
120
+ - spec/outputs/sumologic/compressor_spec.rb
121
+ - spec/outputs/sumologic/header_builder_spec.rb
122
+ - spec/outputs/sumologic/message_queue_spec.rb
123
+ - spec/outputs/sumologic/payload_builder_spec.rb
124
+ - spec/outputs/sumologic/piler_spec.rb
125
+ - spec/outputs/sumologic/sender_spec.rb
126
+ - spec/outputs/sumologic_spec.rb
127
+ - spec/test_server.rb
128
+ homepage: https://github.com/SumoLogic/logstash-output-sumologic
129
+ licenses:
130
+ - Apache-2.0
131
+ metadata:
132
+ logstash_plugin: 'true'
133
+ logstash_group: output
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubygems_version: 3.0.3
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Deliever the log to Sumo Logic cloud service.
153
+ test_files:
154
+ - spec/outputs/sumologic/compressor_spec.rb
155
+ - spec/outputs/sumologic/header_builder_spec.rb
156
+ - spec/outputs/sumologic/message_queue_spec.rb
157
+ - spec/outputs/sumologic/payload_builder_spec.rb
158
+ - spec/outputs/sumologic/piler_spec.rb
159
+ - spec/outputs/sumologic/sender_spec.rb
160
+ - spec/outputs/sumologic_spec.rb
161
+ - spec/test_server.rb