fluent-plugin-out-http 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.md +3 -0
- data/README.md +3 -1
- data/fluent-plugin-out-http.gemspec +1 -1
- data/lib/fluent/plugin/out_http.rb +13 -11
- data/test/plugin/test_out_http.rb +3 -2
- metadata +5 -4
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
# fluent-plugin-out-http
|
1
|
+
# fluent-plugin-out-http, a plugin for [Fluentd](http://fluentd.org)
|
2
2
|
|
3
3
|
A generic [fluentd][1] output plugin for sending logs to an HTTP endpoint.
|
4
4
|
|
5
|
+
[![Build Status](https://travis-ci.org/ento/fluent-plugin-out-http.svg?branch=master)](https://travis-ci.org/ento/fluent-plugin-out-http)
|
6
|
+
|
5
7
|
## Configs
|
6
8
|
|
7
9
|
<match *>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "fluent-plugin-out-http"
|
5
|
-
gem.version = "0.1.
|
5
|
+
gem.version = "0.1.2"
|
6
6
|
gem.authors = ["Marica Odagaki"]
|
7
7
|
gem.email = ["ento.entotto@gmail.com"]
|
8
8
|
gem.summary = %q{A generic Fluentd output plugin to send logs to an HTTP endpoint}
|
@@ -97,25 +97,27 @@ class Fluent::HTTPOutput < Fluent::Output
|
|
97
97
|
end
|
98
98
|
|
99
99
|
res = nil
|
100
|
+
|
100
101
|
begin
|
101
102
|
if @auth and @auth == :basic
|
102
103
|
req.basic_auth(@username, @password)
|
103
104
|
end
|
104
105
|
@last_request_time = Time.now.to_f
|
105
106
|
res = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }
|
106
|
-
rescue
|
107
|
+
rescue # rescue all StandardErrors
|
107
108
|
# server didn't respond
|
108
109
|
$log.warn "Net::HTTP.#{req.method.capitalize} raises exception: #{$!.class}, '#{$!.message}'"
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
110
|
+
else
|
111
|
+
unless res and res.is_a?(Net::HTTPSuccess)
|
112
|
+
res_summary = if res
|
113
|
+
"#{res.code} #{res.message} #{res.body}"
|
114
|
+
else
|
115
|
+
"res=nil"
|
116
|
+
end
|
117
|
+
$log.warn "failed to #{req.method} #{uri} (#{res_summary})"
|
118
|
+
end #end unless
|
119
|
+
end # end begin
|
120
|
+
end # end send_request
|
119
121
|
|
120
122
|
def handle_record(tag, time, record)
|
121
123
|
req, uri = create_request(tag, time, record)
|
@@ -184,7 +184,7 @@ class HTTPOutputTest < HTTPOutputTestBase
|
|
184
184
|
assert_equal '20', record[:form]['field2']
|
185
185
|
assert_equal '10', record[:form]['field3']
|
186
186
|
assert_equal '1', record[:form]['otherfield']
|
187
|
-
assert_equal URI.
|
187
|
+
assert_equal URI.encode_www_form_component("あ").upcase, record[:form]['binary'].upcase
|
188
188
|
assert_nil record[:auth]
|
189
189
|
|
190
190
|
d.emit({ 'field1' => 50, 'field2' => 20, 'field3' => 10, 'otherfield' => 1 })
|
@@ -254,7 +254,8 @@ class HTTPOutputTest < HTTPOutputTestBase
|
|
254
254
|
assert last_emit + RATE_LIMIT_MSEC > _current_msec, "Still under rate limiting interval"
|
255
255
|
assert_equal 1, @posts.size
|
256
256
|
|
257
|
-
|
257
|
+
wait_msec = 500
|
258
|
+
sleep (last_emit + RATE_LIMIT_MSEC - _current_msec + wait_msec) * 0.001
|
258
259
|
|
259
260
|
assert last_emit + RATE_LIMIT_MSEC < _current_msec, "No longer under rate limiting interval"
|
260
261
|
d.emit(record)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-out-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-09-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yajl-ruby
|
@@ -83,6 +83,7 @@ extensions: []
|
|
83
83
|
extra_rdoc_files: []
|
84
84
|
files:
|
85
85
|
- .gitignore
|
86
|
+
- .travis.yml
|
86
87
|
- CHANGELOG.md
|
87
88
|
- Gemfile
|
88
89
|
- LICENSE.txt
|
@@ -106,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
107
|
version: '0'
|
107
108
|
segments:
|
108
109
|
- 0
|
109
|
-
hash:
|
110
|
+
hash: 3802053956636342653
|
110
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
112
|
none: false
|
112
113
|
requirements:
|
@@ -115,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
116
|
version: '0'
|
116
117
|
segments:
|
117
118
|
- 0
|
118
|
-
hash:
|
119
|
+
hash: 3802053956636342653
|
119
120
|
requirements: []
|
120
121
|
rubyforge_project:
|
121
122
|
rubygems_version: 1.8.23
|