fluent-plugin-http-pull 0.7.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,204 +1,227 @@
1
- # fluent-plugin-http-pull
2
-
3
- [![Build Status](https://travis-ci.org/HatsuneMiku3939/fluent-plugin-http-pull.svg?branch=master)](https://travis-ci.org/HatsuneMiku3939/fluent-plugin-http-pull)
4
- [![Build status](https://ci.appveyor.com/api/projects/status/k91x4jyhahoo2it3?svg=true)](https://ci.appveyor.com/project/HatsuneMiku3939/fluent-plugin-http-pull)
5
- [![Gem Version](https://badge.fury.io/rb/fluent-plugin-http-pull.svg)](https://badge.fury.io/rb/fluent-plugin-http-pull)
6
- [![Coverage Status](https://coveralls.io/repos/github/HatsuneMiku3939/fluent-plugin-http-pull/badge.svg?branch=master)](https://coveralls.io/github/HatsuneMiku3939/fluent-plugin-http-pull?branch=master)
7
-
8
-
9
- [Fluentd](http://fluentd.org/) input plugin to pull log from rest api.
10
-
11
- Many of modern server application offer status reporting API via http (even 'fluentd' too). This plugin will help to gathering status log from these status api.
12
-
13
- ## Installation
14
-
15
- ### RubyGems
16
-
17
- ```
18
- $ gem install fluent-plugin-http-pull
19
- ```
20
-
21
- ### Bundler
22
-
23
- Add following line to your Gemfile:
24
-
25
- ```ruby
26
- gem "fluent-plugin-http-pull"
27
- ```
28
-
29
- And then execute:
30
-
31
- ```
32
- $ bundle
33
- ```
34
-
35
- ## Example
36
-
37
- You can found more examples in `test/plugin/test_in_http_pull.rb`
38
-
39
- ### Monitoring http status code only
40
- ```
41
- <source>
42
- @type http_pull
43
-
44
- tag test
45
- url http://www.google.com
46
- interval 1s
47
-
48
- format none
49
- status_only true
50
- </source>
51
-
52
- <match test>
53
- @type stdout
54
- </match>
55
-
56
- # 2017-05-17 21:40:40.413219000 +0900 test: {"url":"http://www.google.com","status":200}
57
- # 2017-05-17 21:40:41.298215000 +0900 test: {"url":"http://www.google.com","status":200}
58
- # 2017-05-17 21:40:42.310993000 +0900 test: {"url":"http://www.google.com","status":200}
59
- # 2017-05-17 21:40:43.305947000 +0900 test: {"url":"http://www.google.com","status":200}
60
- ```
61
-
62
- ### Monitoring fluentd itself
63
- ```
64
- <source>
65
- @type monitor_agent
66
-
67
- port 24220
68
- </source>
69
-
70
- <source>
71
- @type http_pull
72
-
73
- tag fluentd.status
74
- url http://localhost:24220/api/plugins.json
75
- interval 1s
76
-
77
- format json
78
- </source>
79
-
80
- <match fluentd.status>
81
- @type stdout
82
- </match>
83
-
84
- # 2017-05-17 21:41:47.872951000 +0900 fluentd.status: {"url":"http://localhost:24220/api/plugins.json","status":200,"message":{"plugins":[{"plugin_id":"object:1e7e3d...
85
- # 2017-05-17 21:41:48.955316000 +0900 fluentd.status: {"url":"http://localhost:24220/api/plugins.json","status":200,"message":{"plugins":[{"plugin_id":"object:1e7e3d...
86
- # 2017-05-17 21:41:50.033628000 +0900 fluentd.status: {"url":"http://localhost:24220/api/plugins.json","status":200,"message":{"plugins":[{"plugin_id":"object:1e7e3d...
87
- # 2017-05-17 21:41:51.107372000 +0900 fluentd.status: {"url":"http://localhost:24220/api/plugins.json","status":200,"message":{"plugins":[{"plugin_id":"object:1e7e3d...
88
- ```
89
-
90
-
91
- ### Monitoring elasticsearch cluster health
92
- ```
93
- <source>
94
- @type http_pull
95
-
96
- tag es.cluster.health
97
- url http://localhost:9200/_cluster/health
98
- interval 1s
99
-
100
- format json
101
- </source>
102
-
103
- <match es.cluster.health>
104
- @type stdout
105
- </match>
106
-
107
- # 2017-05-17 12:49:09.886298008 +0000 es.cluster.health: {"url":"http://localhost:9200/_cluster/health","status":200,"message":{"cluster_name":"elasticsearch","status":"green",...
108
- # 2017-05-17 12:49:10.669431296 +0000 es.cluster.health: {"url":"http://localhost:9200/_cluster/health","status":200,"message":{"cluster_name":"elasticsearch","status":"green",...
109
- # 2017-05-17 12:49:11.668789668 +0000 es.cluster.health: {"url":"http://localhost:9200/_cluster/health","status":200,"message":{"cluster_name":"elasticsearch","status":"green",...
110
- # 2017-05-17 12:49:12.668789849 +0000 es.cluster.health: {"url":"http://localhost:9200/_cluster/health","status":200,"message":{"cluster_name":"elasticsearch","status":"green",...
111
- ```
112
-
113
- ## Configuration
114
-
115
- ### tag (string) (required)
116
-
117
- The tag of the event.
118
-
119
- ### url (string) (required)
120
-
121
- The url of remote server.
122
-
123
- ### agent (string) (optional, default: fluent-plugin-http-pull)
124
-
125
- The user agent string of request.
126
-
127
- ### interval (time) (required)
128
-
129
- The interval time between periodic request.
130
-
131
- ### format (required)
132
-
133
- The format of the response body. Due to limitation of current implement it is
134
- always required regardless `status_only` option.
135
-
136
- `http_pull` uses parse plugin to parse the response body. See
137
- [parser article](https://docs.fluentd.org/v0.12/articles/parser-plugin-overview)
138
- for more detail.
139
-
140
- ### status_only (bool) (optional, default: false)
141
-
142
- If `status_only` is true, body is not parsed.
143
-
144
- ### http_method (enum) (optional, default: :get)
145
-
146
- The http request method for each requests. Avaliable options are listed below.
147
-
148
- * `get`
149
- * `post`
150
- * `delete`
151
-
152
- If `status_only` is true, `http_method` was override to `head`
153
-
154
- ### timeout (time) (optional, default: 10s)
155
-
156
- The timeout of each request.
157
-
158
- ### proxy (string) (optional, default: nil)
159
-
160
- The HTTP proxy URL to use for each requests
161
-
162
- ### user (string) (optional, default: nil)
163
-
164
- The user for basic auth
165
-
166
- ### password (string) (optional, default: nil)
167
-
168
- The password for basic auth
169
-
170
- ### response_header (section) (optional, default: nil)
171
-
172
- The name of response header for capture.
173
-
174
- ### request_header (section) (optional, default: nil)
175
-
176
- The name, value pair of custom reuqest header.
177
-
178
- ## In case of remote error
179
-
180
- ### Can receive response from remote
181
-
182
- ```
183
- {
184
- "url": url of remote
185
- "status": status code of response
186
- "error": "RestClient::NotFound: 404 Not Found" or something similar
187
- }
188
- ```
189
-
190
- ### All the other case
191
-
192
- ```
193
- {
194
- "url": url of remote
195
- "status": 0
196
- "error": "Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 12345" or something similar
197
- }
198
- ```
199
-
200
- ## Copyright
201
-
202
- * Copyright(c) 2017- filepang
203
- * License
204
- * Apache License, Version 2.0
1
+ # fluent-plugin-http-pull
2
+
3
+ [![Build Status](https://travis-ci.org/HatsuneMiku3939/fluent-plugin-http-pull.svg?branch=master)](https://travis-ci.org/HatsuneMiku3939/fluent-plugin-http-pull)
4
+ [![Build status](https://ci.appveyor.com/api/projects/status/k91x4jyhahoo2it3?svg=true)](https://ci.appveyor.com/project/HatsuneMiku3939/fluent-plugin-http-pull)
5
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-http-pull.svg)](https://badge.fury.io/rb/fluent-plugin-http-pull)
6
+ [![Coverage Status](https://coveralls.io/repos/github/HatsuneMiku3939/fluent-plugin-http-pull/badge.svg?branch=master)](https://coveralls.io/github/HatsuneMiku3939/fluent-plugin-http-pull?branch=master)
7
+
8
+
9
+ [Fluentd](http://fluentd.org/) input plugin to pull log from rest api.
10
+
11
+ Many of modern server application offer status reporting API via http (even 'fluentd' too). This plugin will help to gathering status log from these status api.
12
+
13
+ ## Installation
14
+
15
+ ### RubyGems
16
+
17
+ ```
18
+ $ gem install fluent-plugin-http-pull
19
+ ```
20
+
21
+ ### Bundler
22
+
23
+ Add following line to your Gemfile:
24
+
25
+ ```ruby
26
+ gem "fluent-plugin-http-pull"
27
+ ```
28
+
29
+ And then execute:
30
+
31
+ ```
32
+ $ bundle
33
+ ```
34
+
35
+ ## Example
36
+
37
+ You can found more examples in `test/plugin/test_in_http_pull.rb`
38
+
39
+ ### Monitoring http status code only
40
+ ```
41
+ <source>
42
+ @type http_pull
43
+
44
+ tag test
45
+ url http://www.google.com
46
+ interval 1s
47
+
48
+ format none
49
+ status_only true
50
+ </source>
51
+
52
+ <match test>
53
+ @type stdout
54
+ </match>
55
+
56
+ # 2017-05-17 21:40:40.413219000 +0900 test: {"url":"http://www.google.com","status":200}
57
+ # 2017-05-17 21:40:41.298215000 +0900 test: {"url":"http://www.google.com","status":200}
58
+ # 2017-05-17 21:40:42.310993000 +0900 test: {"url":"http://www.google.com","status":200}
59
+ # 2017-05-17 21:40:43.305947000 +0900 test: {"url":"http://www.google.com","status":200}
60
+ ```
61
+
62
+ ### Monitoring fluentd itself
63
+ ```
64
+ <source>
65
+ @type monitor_agent
66
+
67
+ port 24220
68
+ </source>
69
+
70
+ <source>
71
+ @type http_pull
72
+
73
+ tag fluentd.status
74
+ url http://localhost:24220/api/plugins.json
75
+ interval 1s
76
+
77
+ format json
78
+ </source>
79
+
80
+ <match fluentd.status>
81
+ @type stdout
82
+ </match>
83
+
84
+ # 2017-05-17 21:41:47.872951000 +0900 fluentd.status: {"url":"http://localhost:24220/api/plugins.json","status":200,"message":{"plugins":[{"plugin_id":"object:1e7e3d...
85
+ # 2017-05-17 21:41:48.955316000 +0900 fluentd.status: {"url":"http://localhost:24220/api/plugins.json","status":200,"message":{"plugins":[{"plugin_id":"object:1e7e3d...
86
+ # 2017-05-17 21:41:50.033628000 +0900 fluentd.status: {"url":"http://localhost:24220/api/plugins.json","status":200,"message":{"plugins":[{"plugin_id":"object:1e7e3d...
87
+ # 2017-05-17 21:41:51.107372000 +0900 fluentd.status: {"url":"http://localhost:24220/api/plugins.json","status":200,"message":{"plugins":[{"plugin_id":"object:1e7e3d...
88
+ ```
89
+
90
+
91
+ ### Monitoring elasticsearch cluster health
92
+ ```
93
+ <source>
94
+ @type http_pull
95
+
96
+ tag es.cluster.health
97
+ url http://localhost:9200/_cluster/health
98
+ interval 1s
99
+
100
+ format json
101
+ </source>
102
+
103
+ <match es.cluster.health>
104
+ @type stdout
105
+ </match>
106
+
107
+ # 2017-05-17 12:49:09.886298008 +0000 es.cluster.health: {"url":"http://localhost:9200/_cluster/health","status":200,"message":{"cluster_name":"elasticsearch","status":"green",...
108
+ # 2017-05-17 12:49:10.669431296 +0000 es.cluster.health: {"url":"http://localhost:9200/_cluster/health","status":200,"message":{"cluster_name":"elasticsearch","status":"green",...
109
+ # 2017-05-17 12:49:11.668789668 +0000 es.cluster.health: {"url":"http://localhost:9200/_cluster/health","status":200,"message":{"cluster_name":"elasticsearch","status":"green",...
110
+ # 2017-05-17 12:49:12.668789849 +0000 es.cluster.health: {"url":"http://localhost:9200/_cluster/health","status":200,"message":{"cluster_name":"elasticsearch","status":"green",...
111
+ ```
112
+
113
+ ## Configuration
114
+
115
+ ### Basic options
116
+
117
+ #### tag (string) (required)
118
+
119
+ The tag of the event.
120
+
121
+ #### url (string) (required)
122
+
123
+ The url of remote server.
124
+
125
+ #### agent (string) (optional, default: fluent-plugin-http-pull)
126
+
127
+ The user agent string of request.
128
+
129
+ #### interval (time) (required)
130
+
131
+ The interval time between periodic request.
132
+
133
+ #### format (required)
134
+
135
+ The format of the response body. Due to limitation of current implement it is
136
+ always required regardless `status_only` option.
137
+
138
+ `http_pull` uses parse plugin to parse the response body. See
139
+ [parser article](https://docs.fluentd.org/v0.12/articles/parser-plugin-overview)
140
+ for more detail.
141
+
142
+ #### status_only (bool) (optional, default: false)
143
+
144
+ If `status_only` is true, body is not parsed.
145
+
146
+ ###E http_method (enum) (optional, default: :get)
147
+
148
+ The http request method for each requests. Avaliable options are listed below.
149
+
150
+ * `get`
151
+ * `post`
152
+ * `delete`
153
+
154
+ If `status_only` is true, `http_method` was override to `head`
155
+
156
+ #### timeout (time) (optional, default: 10s)
157
+
158
+ The timeout of each request.
159
+
160
+ ### Proxy options`
161
+
162
+ #### proxy (string) (optional, default: nil)
163
+
164
+ The HTTP proxy URL to use for each requests
165
+
166
+ ### Basic auth options
167
+
168
+ #### user (string) (optional, default: nil)
169
+
170
+ The user for basic auth
171
+
172
+ #### password (string) (optional, default: nil)
173
+
174
+ The password for basic auth
175
+
176
+ ### Req/Resp header options
177
+
178
+ #### response_header (section) (optional, default: nil)
179
+
180
+ The name of response header for capture.
181
+
182
+ #### request_header (section) (optional, default: nil)
183
+
184
+ The name, value pair of custom reuqest header.
185
+
186
+ ### SSL options
187
+
188
+ #### verify_ssl (bool) (optional, default: true)
189
+
190
+ When false, SSL verification is ignored.
191
+
192
+ #### ca_path (string) (optional, defualt: nil)
193
+
194
+ The absolute path of directory where ca_file stored. Should be used with `ca_file`.
195
+
196
+ #### ca_file (string) (optional, defualt: nil)
197
+
198
+ The Absolute path of ca_file. Should be used with `ca_path`.
199
+
200
+
201
+ ## In case of remote error
202
+
203
+ ### Can receive response from remote
204
+
205
+ ```
206
+ {
207
+ "url": url of remote
208
+ "status": status code of response
209
+ "error": "RestClient::NotFound: 404 Not Found" or something similar
210
+ }
211
+ ```
212
+
213
+ ### All the other case
214
+
215
+ ```
216
+ {
217
+ "url": url of remote
218
+ "status": 0
219
+ "error": "Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 12345" or something similar
220
+ }
221
+ ```
222
+
223
+ ## Copyright
224
+
225
+ * Copyright(c) 2017- filepang
226
+ * License
227
+ * Apache License, Version 2.0
data/Rakefile CHANGED
@@ -1,24 +1,24 @@
1
- require "bundler"
2
- Bundler::GemHelper.install_tasks
3
-
4
- require "rake/testtask"
5
- require "fileutils"
6
-
7
- Rake::TestTask.new(:test) do |t|
8
- if File.exists? "stub_server.log"
9
- puts "clear stub_server.log"
10
- FileUtils.rm "stub_server.log"
11
- end
12
-
13
- if File.exists? "stub_proxy.log"
14
- puts "clear stub_proxy.log"
15
- FileUtils.rm "stub_proxy.log"
16
- end
17
-
18
- t.libs.push("lib", "test")
19
- t.test_files = FileList["test/**/test_*.rb"]
20
- t.verbose = true
21
- t.warning = true
22
- end
23
-
24
- task default: [:test]
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require "rake/testtask"
5
+ require "fileutils"
6
+
7
+ Rake::TestTask.new(:test) do |t|
8
+ if File.exists? "stub_server.log"
9
+ puts "clear stub_server.log"
10
+ FileUtils.rm "stub_server.log"
11
+ end
12
+
13
+ if File.exists? "stub_proxy.log"
14
+ puts "clear stub_proxy.log"
15
+ FileUtils.rm "stub_proxy.log"
16
+ end
17
+
18
+ t.libs.push("lib", "test")
19
+ t.test_files = FileList["test/**/test_*.rb"]
20
+ t.verbose = true
21
+ t.warning = true
22
+ end
23
+
24
+ task default: [:test]