logstash-output-thetapoint 0.1.0 → 0.1.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/Gemfile.lock +1 -1
- data/lib/logstash/outputs/thetapoint.rb +18 -11
- data/logstash-output-thetapoint.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e400532fad8967b601749b044d9ef5e70f53f3c
|
4
|
+
data.tar.gz: 02aae0ef8bbd7cd821d7f30294296c6e05f7c11c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b70c2c7c26227c078e9b71a6efbcd18a7954818a9fde1809a05bfb8e4a42f789a62a51805e94898643e053e5ca662e6c91befc21b75b337a9084e92ef0da56e7
|
7
|
+
data.tar.gz: 7157271826b56224e63a383b340b14cbe7f8fcb6a4c1cd6e3e886d63fbb77e74f2eee36b2f2cd8df68d99cfdd8a12afb81c197df18e378c1e714a23f7cf08da9
|
data/Gemfile.lock
CHANGED
@@ -7,6 +7,7 @@ require "net/https"
|
|
7
7
|
require "stud/buffer"
|
8
8
|
require "zlib"
|
9
9
|
require 'time'
|
10
|
+
require 'json'
|
10
11
|
|
11
12
|
#
|
12
13
|
# This is most useful so you can use logstash to parse and structure
|
@@ -19,7 +20,6 @@ class LogStash::Outputs::ThetaPoint < LogStash::Outputs::Base
|
|
19
20
|
include Stud::Buffer
|
20
21
|
|
21
22
|
config_name "thetapoint"
|
22
|
-
milestone 3
|
23
23
|
|
24
24
|
# The hostname to send logs to.
|
25
25
|
config :host, :validate => :string, :default => "api.theta-point.com"
|
@@ -75,6 +75,8 @@ class LogStash::Outputs::ThetaPoint < LogStash::Outputs::Base
|
|
75
75
|
def receive(event)
|
76
76
|
return unless output?(event)
|
77
77
|
|
78
|
+
@logger.info("receive: #{event}")
|
79
|
+
|
78
80
|
if event == LogStash::SHUTDOWN
|
79
81
|
finished
|
80
82
|
return
|
@@ -82,24 +84,28 @@ class LogStash::Outputs::ThetaPoint < LogStash::Outputs::Base
|
|
82
84
|
|
83
85
|
if @batch
|
84
86
|
# Stud::Buffer
|
85
|
-
|
87
|
+
@logger.info("receive: Buffer Event")
|
88
|
+
buffer_receive(event, @key)
|
86
89
|
return
|
87
90
|
end
|
88
91
|
|
89
|
-
|
92
|
+
@logger.info("receive: Send Single Event")
|
93
|
+
send_data(event.to_json, @key)
|
90
94
|
|
91
95
|
end # def receive
|
92
96
|
|
93
|
-
def
|
97
|
+
def send_data(data, key)
|
98
|
+
|
94
99
|
# Comress data
|
95
100
|
if @compress
|
96
101
|
@logger.info("Deflate start", :now => Time.now.rfc2822, :length => data.length)
|
97
|
-
|
98
|
-
@logger.info("Deflate end", :now => Time.now.rfc2822, :length =>
|
102
|
+
post_data = Zlib::Deflate.deflate(data, Zlib::BEST_COMPRESSION)
|
103
|
+
@logger.info("Deflate end", :now => Time.now.rfc2822, :length => post_data.length, :ratio => post_data.length/data.length)
|
99
104
|
@path = "zbulk"
|
100
105
|
else
|
101
|
-
|
106
|
+
post_data = data
|
102
107
|
end
|
108
|
+
|
103
109
|
# Send the data
|
104
110
|
@logger.info("ThetaPoint Connect: ",
|
105
111
|
:host => @host,
|
@@ -107,7 +113,7 @@ class LogStash::Outputs::ThetaPoint < LogStash::Outputs::Base
|
|
107
113
|
:proxy_host => @proxy_host,
|
108
114
|
:proxy_port => @proxy_port,
|
109
115
|
:proxy_user => @proxy_user,
|
110
|
-
:proxy_password => @proxy_password.value)
|
116
|
+
:proxy_password => @proxy_password ? @proxy_password.value : nil)
|
111
117
|
@http = Net::HTTP.new(@host, @port, @proxy_host, @proxy_port, @proxy_user, @proxy_password.value)
|
112
118
|
@logger.info("http", :http => @http)
|
113
119
|
if @proto == 'https'
|
@@ -118,7 +124,7 @@ class LogStash::Outputs::ThetaPoint < LogStash::Outputs::Base
|
|
118
124
|
begin
|
119
125
|
@logger.info("Submit start", :now => Time.now.rfc2822)
|
120
126
|
uri = "/#{@path}/#{@key}"
|
121
|
-
response = @http.request_post(uri,
|
127
|
+
response = @http.request_post(uri, post_data)
|
122
128
|
@logger.info("Submit end", :now => Time.now.rfc2822)
|
123
129
|
@logger.info("response", :response => response)
|
124
130
|
if response.is_a?(Net::HTTPSuccess)
|
@@ -130,11 +136,12 @@ class LogStash::Outputs::ThetaPoint < LogStash::Outputs::Base
|
|
130
136
|
@logger.error("ThetaPoint Unhandled exception", :pd_error => e.backtrace)
|
131
137
|
end
|
132
138
|
|
133
|
-
end # def
|
139
|
+
end # def send_data
|
134
140
|
|
135
141
|
# called from Stud::Buffer#buffer_flush when there are events to flush
|
136
142
|
def flush(events, key, teardown=false)
|
137
|
-
|
143
|
+
@logger.info("Flush #{events.length} events")
|
144
|
+
send_data(events.to_json, key)
|
138
145
|
end # def flush
|
139
146
|
|
140
147
|
# called from Stud::Buffer#buffer_flush when an error occurs
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-thetapoint'
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.1"
|
4
4
|
s.licenses = ["Apache License (2.0)"]
|
5
5
|
s.summary = "This thetapoint output does nothing."
|
6
6
|
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"
|