logstash-output-splunk 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +2 -0
- data/CONTRIBUTORS +16 -0
- data/Gemfile +11 -0
- data/LICENSE +13 -0
- data/NOTICE.TXT +5 -0
- data/README.md +93 -0
- data/docs/index.asciidoc +392 -0
- data/lib/logstash/outputs/splunk.rb +344 -0
- data/logstash-output-splunk.gemspec +29 -0
- data/spec/outputs/splunk_spec.rb +364 -0
- data/spec/supports/compressed_requests.rb +38 -0
- metadata +142 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# based on relistan's rack handler
|
4
|
+
# out of the box rack only gives use the rack deflater handler to return compressed
|
5
|
+
# response, this gist offer the inverse and should work on all rack based app like sinatra or rails.
|
6
|
+
#
|
7
|
+
# original source: https://gist.github.com/relistan/2109707
|
8
|
+
require "zlib"
|
9
|
+
|
10
|
+
class CompressedRequests
|
11
|
+
def initialize(app)
|
12
|
+
@app = app
|
13
|
+
end
|
14
|
+
|
15
|
+
def encoding_handled?(env)
|
16
|
+
['gzip', 'deflate'].include? env['HTTP_CONTENT_ENCODING']
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
if encoding_handled?(env)
|
21
|
+
extracted = decode(env['rack.input'], env['HTTP_CONTENT_ENCODING'])
|
22
|
+
|
23
|
+
env.delete('HTTP_CONTENT_ENCODING')
|
24
|
+
env['CONTENT_LENGTH'] = extracted.bytesize
|
25
|
+
env['rack.input'] = StringIO.new(extracted)
|
26
|
+
end
|
27
|
+
|
28
|
+
status, headers, response = @app.call(env)
|
29
|
+
return [status, headers, response]
|
30
|
+
end
|
31
|
+
|
32
|
+
def decode(input, content_encoding)
|
33
|
+
case content_encoding
|
34
|
+
when 'gzip' then Zlib::GzipReader.new(input).read
|
35
|
+
when 'deflate' then Zlib::Inflate.inflate(input.read)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-output-splunk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jian Chen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-02-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: logstash-core-plugin-api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.60'
|
20
|
+
- - "<="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.99'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.60'
|
30
|
+
- - "<="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.99'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: logstash-mixin-http_client
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 6.0.0
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 8.0.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 6.0.0
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 8.0.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: logstash-devutils
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: sinatra
|
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: webrick
|
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 plugin required to be installed on top of the
|
96
|
+
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
97
|
+
gem is not a stand-alone program
|
98
|
+
email: jianchen2580@gmail.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- CHANGELOG.md
|
104
|
+
- CONTRIBUTORS
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE
|
107
|
+
- NOTICE.TXT
|
108
|
+
- README.md
|
109
|
+
- docs/index.asciidoc
|
110
|
+
- lib/logstash/outputs/splunk.rb
|
111
|
+
- logstash-output-splunk.gemspec
|
112
|
+
- spec/outputs/splunk_spec.rb
|
113
|
+
- spec/supports/compressed_requests.rb
|
114
|
+
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
115
|
+
licenses:
|
116
|
+
- Apache License (2.0)
|
117
|
+
metadata:
|
118
|
+
logstash_plugin: 'true'
|
119
|
+
logstash_group: output
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.4.6
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: Sends events to a Splunk HTTP Event Collector REST API endpoints
|
140
|
+
test_files:
|
141
|
+
- spec/outputs/splunk_spec.rb
|
142
|
+
- spec/supports/compressed_requests.rb
|