fluent-plugin-elasticsearch-patch 1.3.0.p1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ee375db282e26e2170754cbb4ee07099ca7047be
4
+ data.tar.gz: 2359d123bfa86bc22e7e367e0b7f911855a295ab
5
+ SHA512:
6
+ metadata.gz: 4d742a701d31cb78176d0a5cf567748fa474493aa3994b588149efa7872a6689c7dd4d8c478b6de85fac8c66e9bd6536e42d2792b2b871650c2d11e832aa50a3
7
+ data.tar.gz: 41d73c71e7a2203e8478058f0785c53bea389bdd35fa405e0bf5ece8275c160cd45ad323a5b62f97405764f6d656d84826443083dd1af260936e815c4550e505
@@ -0,0 +1,2 @@
1
+ service_name: travis-ci
2
+
@@ -0,0 +1,9 @@
1
+ # EditorConfig: http://EditorConfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+ indent_style = space
9
+ indent_size = 2
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1
7
+ - 2.2
8
+
9
+ script: bundle exec rake test
10
+ sudo: false
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-elasticsearch.gemspec
4
+ gemspec
5
+
6
+ gem 'simplecov', require: false
7
+ gem 'coveralls', require: false
@@ -0,0 +1,74 @@
1
+ ## Changelog
2
+
3
+ ### 1.3.0
4
+ - add `write_operation`
5
+
6
+ ### 1.2.1
7
+ - fix `resurrect_after` in out_elasticsearch_dynamic
8
+
9
+ ### 1.2.0
10
+ - out_elasticsearch_dynamic get memory improvement and fix for race condition (#133)
11
+ - Add `resurrect_after` option (#136)
12
+
13
+ ### 1.1.0
14
+ - Support SSL client verification and custom CA file (#123)
15
+ - Release experimental `type elasticsearch_dynamic` (#127)
16
+
17
+ ### 1.0.0
18
+ - password config param is now marked as secret and won't be displayed in logs.
19
+
20
+ ### 0.9.0
21
+ - Add `ssl_verify` option (#108)
22
+
23
+ ### 0.8.0
24
+ - Replace Patron with Excon HTTP client (#93)
25
+
26
+ ### 0.7.0
27
+ - Add new option `time_key` (#85)
28
+
29
+ ### 0.6.1
30
+ - 0.10.43 is minimum version required of fluentd (#79)
31
+
32
+ ### 0.6.0
33
+ - added `reload_on_failure` and `reload_connections` flags (#78)
34
+
35
+ ### 0.5.1
36
+ - fix legacy hosts option, port should be optional (#75)
37
+
38
+ ### 0.5.0
39
+ - add full connection URI support (#65)
40
+ - use `@timestamp` for index (#41)
41
+ - add support for elasticsearch gem version 1 (#71)
42
+ - fix connection reset & retry when connection is lost (#67)
43
+
44
+ ### 0.4.0
45
+ - add `request_timeout` config (#59)
46
+ - fix lockup when non-hash values are sent (#52)
47
+
48
+ ### 0.3.1
49
+ - force using patron (#46)
50
+ - do not generate @timestamp if already part of message (#35)
51
+
52
+ ### 0.3.0
53
+ - add `parent_key` option (#28)
54
+ - have travis-ci build on multiple rubies (#30)
55
+ - add `utc_index` and `hosts` options, switch to using `elasticsearch` gem (#26, #29)
56
+
57
+ ### 0.2.0
58
+ - fix encoding issues with JSON conversion and again when sending to elasticsearch (#19, #21)
59
+ - add logstash_dateformat option (#20)
60
+
61
+ ### 0.1.4
62
+ - add logstash_prefix option
63
+
64
+ ### 0.1.3
65
+ - raising an exception on non-success response from elasticsearch
66
+
67
+ ### 0.1.2
68
+ - add id_key option
69
+
70
+ ### 0.1.1
71
+ - fix timezone in logstash key
72
+
73
+ ### 0.1.0
74
+ - Initial gem release.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Uken Games
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,324 @@
1
+ # Fluent::Plugin::Elasticsearch, a plugin for [Fluentd](http://fluentd.org)
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-elasticsearch.png)](http://badge.fury.io/rb/fluent-plugin-elasticsearch)
4
+ [![Build Status](https://travis-ci.org/uken/fluent-plugin-elasticsearch.png?branch=master)](https://travis-ci.org/uken/fluent-plugin-elasticsearch)
5
+ [![Coverage Status](https://coveralls.io/repos/uken/fluent-plugin-elasticsearch/badge.png)](https://coveralls.io/r/uken/fluent-plugin-elasticsearch)
6
+ [![Code Climate](https://codeclimate.com/github/uken/fluent-plugin-elasticsearch.png)](https://codeclimate.com/github/uken/fluent-plugin-elasticsearch)
7
+ [![Issue Stats](http://issuestats.com/github/uken/fluent-plugin-elasticsearch/badge/pr)](http://issuestats.com/github/uken/fluent-plugin-elasticsearch)
8
+ [![Issue Stats](http://issuestats.com/github/uken/fluent-plugin-elasticsearch/badge/issue)](http://issuestats.com/github/uken/fluent-plugin-elasticsearch)
9
+
10
+ Send your logs to ElasticSearch (and search them with Kibana maybe?)
11
+
12
+ Note: For Amazon Elasticsearch Service please consider using [fluent-plugin-aws-elasticsearch-service](https://github.com/atomita/fluent-plugin-aws-elasticsearch-service)
13
+
14
+ * [Installation](#installation)
15
+ * [Usage](#usage)
16
+ + [Index templates](#index-templates)
17
+ * [Configuration](#configuration)
18
+ + [hosts](#hosts)
19
+ + [user, password, path, scheme, ssl_verify](#user-password-path-scheme-ssl_verify)
20
+ + [logstash_format](#logstash_format)
21
+ + [logstash_prefix](#logstash_prefix)
22
+ + [logstash_dateformat](#logstash_dateformat)
23
+ + [time_key](#time_key)
24
+ + [utc_index](#utc_index)
25
+ + [request_timeout](#request_timeout)
26
+ + [reload_connections](#reload_connections)
27
+ + [reload_on_failure](#reload_on_failure)
28
+ + [resurrect_after](#resurrect_after)
29
+ + [include_tag_key, tag_key](#include_tag_key-tag_key)
30
+ + [id_key](#id_key)
31
+ + [write_operation](#write_operation)
32
+ + [Client/host certificate options](#clienthost-certificate-options)
33
+ + [Buffered output options](#buffered-output-options)
34
+ + [Not seeing a config you need?](#not-seeing-a-config-you-need)
35
+ + [Dynamic configuration](#dynamic-configuration)
36
+ * [Contact](#contact)
37
+ * [Contributing](#contributing)
38
+ * [Running tests](#running-tests)
39
+
40
+ ## Installation
41
+
42
+ ```sh
43
+ $ gem install fluent-plugin-elasticsearch
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ In your Fluentd configuration, use `type elasticsearch`. Additional configuration is optional, default values would look like this:
49
+
50
+ ```
51
+ <match my.logs>
52
+ type elasticsearch
53
+ host localhost
54
+ port 9200
55
+ index_name fluentd
56
+ type_name fluentd
57
+ </match>
58
+ ```
59
+
60
+ ### Index templates
61
+
62
+ This plugin creates ElasticSearch indices by merely writing to them. Consider using [Index Templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html) to gain control of what get indexed and how. See [this example](https://github.com/uken/fluent-plugin-elasticsearch/issues/33#issuecomment-38693282) for a good starting point.
63
+
64
+ ## Configuration
65
+
66
+ ### hosts
67
+
68
+ ```
69
+ hosts host1:port1,host2:port2,host3:port3
70
+ # or
71
+ hosts https://customhost.com:443/path,https://username:password@host-failover.com:443
72
+ ```
73
+
74
+ You can specify multiple ElasticSearch hosts with separator ",".
75
+
76
+ If you specify multiple hosts, this plugin will load balance updates to ElasticSearch. This is an [elasticsearch-ruby](https://github.com/elasticsearch/elasticsearch-ruby) feature, the default strategy is round-robin.
77
+
78
+ ### user, password, path, scheme, ssl_verify
79
+
80
+ If you specify this option, host and port options are ignored.
81
+
82
+ ```
83
+ user demo
84
+ password secret
85
+ path /elastic_search/
86
+ scheme https
87
+ ```
88
+
89
+ You can specify user and password for HTTP basic auth. If used in conjunction with a hosts list, then these options will be used by default i.e. if you do not provide any of these options within the hosts listed.
90
+
91
+ Specify `ssl_verify false` to skip ssl verification (defaults to true)
92
+
93
+ ### logstash_format
94
+
95
+ ```
96
+ logstash_format true # defaults to false
97
+ ```
98
+
99
+ This is meant to make writing data into ElasticSearch compatible to what [Logstash](https://www.elastic.co/products/logstash) writes. By doing this, one could take advantage of [Kibana](https://www.elastic.co/products/kibana).
100
+
101
+ ### logstash_prefix
102
+
103
+ ```
104
+ logstash_prefix mylogs # defaults to "logstash"
105
+ ```
106
+
107
+ ### logstash_dateformat
108
+
109
+ By default, the records inserted into index `logstash-YYMMDD`. This option allows to insert into specified index like `mylogs-YYYYMM` for a monthly index.
110
+
111
+ ```
112
+ logstash_dateformat %Y.%m. # defaults to "%Y.%m.%d"
113
+ ```
114
+
115
+ ### time_key
116
+
117
+ By default, when inserting records in [Logstash](https://www.elastic.co/products/logstash) format, `@timestamp` is dynamically created with the time at log ingestion. If you'd like to use a custom time, include an `@timestamp` with your record.
118
+
119
+ ```
120
+ {"@timestamp":"2014-04-07T000:00:00-00:00"}
121
+ ```
122
+
123
+ You can specify an option `time_key` (like the option described in [tail Input Plugin](http://docs.fluentd.org/articles/in_tail)) to replace `@timestamp` key.
124
+
125
+ Suppose you have settings
126
+
127
+ ```
128
+ logstash_format true
129
+ time_key vtm
130
+ ```
131
+
132
+ Your input is:
133
+ ```
134
+ {
135
+ "title": "developer",
136
+ "vtm": "2014-12-19T08:01:03Z"
137
+ }
138
+ ```
139
+
140
+ The output will be
141
+ ```
142
+ {
143
+ "title": "developer",
144
+ "@timstamp": "2014-12-19T08:01:03Z",
145
+ "vtm": "2014-12-19T08:01:03Z"
146
+ }
147
+ ```
148
+
149
+ ### utc_index
150
+
151
+ ```
152
+ utc_index true
153
+ ```
154
+
155
+ By default, the records inserted into index `logstash-YYMMDD` with UTC (Coordinated Universal Time). This option allows to use local time if you describe utc_index to false.
156
+
157
+ ### request_timeout
158
+
159
+ You can specify HTTP request timeout.
160
+
161
+ This is useful when ElasticSearch cannot return response for bulk request within the default of 5 seconds.
162
+
163
+ ```
164
+ request_timeout 15s # defaults to 5s
165
+ ```
166
+
167
+ ### reload_connections
168
+
169
+ You can tune how the elasticsearch-transport host reloading feature works. By default it will reload the host list from the server every 10,000th request to spread the load. This can be an issue if your ElasticSearch cluster is behind a Reverse Proxy, as Fluentd process may not have direct network access to the ElasticSearch nodes.
170
+
171
+ ```
172
+ reload_connections false # defaults to true
173
+ ```
174
+
175
+ ### reload_on_failure
176
+
177
+ Indicates that the elasticsearch-transport will try to reload the nodes addresses if there is a failure while making the
178
+ request, this can be useful to quickly remove a dead node from the list of addresses.
179
+
180
+ ```
181
+ reload_on_failure true # defaults to false
182
+ ```
183
+
184
+ ### resurrect_after
185
+
186
+ You can set in the elasticsearch-transport how often dead connections from the elasticsearch-transport's pool will be resurrected.
187
+
188
+ ```
189
+ resurrect_after 5 # defaults to 60s
190
+ ```
191
+
192
+ ### include_tag_key, tag_key
193
+
194
+ ```
195
+ include_tag_key true # defaults to false
196
+ tag_key tag # defaults to tag
197
+ ```
198
+
199
+ This will add the Fluentd tag in the JSON record. For instance, if you have a config like this:
200
+
201
+ ```
202
+ <match my.logs>
203
+ type elasticsearch
204
+ include_tag_key true
205
+ tag_key _key
206
+ </match>
207
+ ```
208
+
209
+ The record inserted into ElasticSearch would be
210
+
211
+ ```
212
+ {"_key":"my.logs", "name":"Johnny Doeie"}
213
+ ```
214
+
215
+ ### id_key
216
+
217
+ ```
218
+ id_key request_id # use "request_id" field as a record id in ES
219
+ ```
220
+
221
+ By default, all records inserted into ElasticSearch get a random _id. This option allows to use a field in the record as an identifier.
222
+
223
+ This following record `{"name":"Johnny","request_id":"87d89af7daffad6"}` will trigger the following ElasticSearch command
224
+
225
+ ```
226
+ { "index" : { "_index" : "logstash-2013.01.01, "_type" : "fluentd", "_id" : "87d89af7daffad6" } }
227
+ { "name": "Johnny", "request_id": "87d89af7daffad6" }
228
+ ```
229
+
230
+ ### write_operation
231
+
232
+ The write_operation can be any of:
233
+
234
+ | Operation | Description |
235
+ | ------------- | ----------- |
236
+ | index (default) | new data is added while existing data (based on its id) is replaced (reindexed).|
237
+ | create | adds new data - if the data already exists (based on its id), the op is skipped.|
238
+ | update | updates existing data (based on its id). If no data is found, the op is skipped.|
239
+ | upsert | known as merge or insert if the data does not exist, updates if the data exists (based on its id).|
240
+
241
+ **Please note, id is required in create, update, and upsert scenario. Without id, the message will be dropped.**
242
+
243
+ ### Client/host certificate options
244
+
245
+ Need to verify ElasticSearch's certificate? You can use the following parameter to specify a CA instead of using an environment variable.
246
+ ```
247
+ ca_file /path/to/your/ca/cert
248
+ ```
249
+
250
+ Does your ElasticSearch cluster want to verify client connections? You can specify the following parameters to use your client certificate, key, and key password for your connection.
251
+ ```
252
+ client_cert /path/to/your/client/cert
253
+ client_key /path/to/your/private/key
254
+ client_key_pass password
255
+ ```
256
+
257
+ ### Buffered output options
258
+
259
+ `fluentd-plugin-elasticsearch` extends [Fluentd's builtin Buffered Output plugin](http://docs.fluentd.org/articles/buffer-plugin-overview). It adds the following options:
260
+
261
+ ```
262
+ buffer_type memory
263
+ flush_interval 60
264
+ retry_limit 17
265
+ retry_wait 1.0
266
+ num_threads 1
267
+ ```
268
+
269
+ The value for option `buffer_chunk_limit` should not exceed value `http.max_content_length` in your Elasticsearch setup (by default it is 104857600 bytes).
270
+
271
+ ### Not seeing a config you need?
272
+
273
+ We try to keep the scope of this plugin small and not add too many configuration options. If you think an option would be useful to others, feel free to open an issue or contribute a Pull Request.
274
+
275
+ Alternatively, consider using [fluent-plugin-forest](https://github.com/tagomoris/fluent-plugin-forest). For example, to configure multiple tags to be sent to different ElasticSearch indices:
276
+
277
+ ```
278
+ <match my.logs.*>
279
+ type forest
280
+ subtype elasticsearch
281
+ remove_prefix my.logs
282
+ <template>
283
+ logstash_prefix ${tag}
284
+ # ...
285
+ </template>
286
+ </match>
287
+ ```
288
+
289
+ And yet another option is described in Dynamic Configuration section.
290
+
291
+ ### Dynamic configuration
292
+
293
+ If you want configurations to depend on information in messages, you can use `elasticsearch_dynamic`. This is an experimental variation of the ElasticSearch plugin allows configuration values to be specified in ways such as the below:
294
+
295
+ ```
296
+ <match my.logs.*>
297
+ type elasticsearch_dynamic
298
+ hosts ${record['host1']}:9200,${record['host2']}:9200
299
+ index_name my_index.${Time.at(time).getutc.strftime(@logstash_dateformat)}
300
+ logstash_prefix ${tag_parts[3]}
301
+ port ${9200+rand(4)}
302
+ index_name ${tag_parts[2]}-${Time.at(time).getutc.strftime(@logstash_dateformat)}
303
+ </match>
304
+ ```
305
+
306
+ **Please note, this uses Ruby's `eval` for every message, so there are performance and security implications.**
307
+
308
+ ## Contact
309
+
310
+ If you have a question, [open an Issue](https://github.com/uken/fluent-plugin-elasticsearch/issues).
311
+
312
+ ## Contributing
313
+
314
+ Pull Requests are welcomed.
315
+
316
+ ## Running tests
317
+
318
+ Install dev dependencies:
319
+
320
+ ```sh
321
+ $ gem install bundler
322
+ $ bundle install
323
+ $ bundle exec rake test
324
+ ```