logstash-output-thetapoint 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee92e8be35167e5f6733532e4d9c2d38e5d6f721
4
- data.tar.gz: 705459cd21e91278e020a1796beb81bfe56c21c6
3
+ metadata.gz: 2e400532fad8967b601749b044d9ef5e70f53f3c
4
+ data.tar.gz: 02aae0ef8bbd7cd821d7f30294296c6e05f7c11c
5
5
  SHA512:
6
- metadata.gz: 50ae2fb42a5bafae6226992e29545aa125577aa3261274571343f570774aceb7aed2b14196f83b279b2cb001a0fadabc1283803e5a3b1e479c8af402e3190699
7
- data.tar.gz: 615dcdcb35564b0ccac04b1c8fa001f079fb542eda7ac921c4292416fc7c297db5a34becbfaf8b0caf3961053bd0ad696898b036f9e7ef8505cac37f0cd7eaef
6
+ metadata.gz: b70c2c7c26227c078e9b71a6efbcd18a7954818a9fde1809a05bfb8e4a42f789a62a51805e94898643e053e5ca662e6c91befc21b75b337a9084e92ef0da56e7
7
+ data.tar.gz: 7157271826b56224e63a383b340b14cbe7f8fcb6a4c1cd6e3e886d63fbb77e74f2eee36b2f2cd8df68d99cfdd8a12afb81c197df18e378c1e714a23f7cf08da9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- logstash-output-thetapoint (0.1.0)
4
+ logstash-output-thetapoint (0.1.1)
5
5
  logstash-codec-plain
6
6
  logstash-core (>= 1.4.0, < 2.0.0)
7
7
 
@@ -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
- buffer_receive(event, event.sprintf(@key))
87
+ @logger.info("receive: Buffer Event")
88
+ buffer_receive(event, @key)
86
89
  return
87
90
  end
88
91
 
89
- sendEvent(event.to_json, event.sprintf(@key))
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 sendEvent(data, key)
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
- send_data = Zlib::Deflate.deflate(data, Zlib::BEST_COMPRESSION)
98
- @logger.info("Deflate end", :now => Time.now.rfc2822, :length => send_data.length, :ratio => send_data.length/data.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
- send_data = data
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, send_data)
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 sendEvent
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
- sendEvent(events.to_json, key)
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.0"
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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-thetapoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ThetaPoint