fluent-plugin-elasticsearch 2.0.0.rc.4 → 2.0.0.rc.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +5 -1
- data/ISSUE_TEMPLATE.md +5 -0
- data/README.md +20 -3
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/out_elasticsearch.rb +4 -2
- data/test/plugin/test_out_elasticsearch.rb +19 -0
- data/test/plugin/test_out_elasticsearch_dynamic.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cc6bc3f6b89a0735bf96c5c0575d39e58458746
|
4
|
+
data.tar.gz: ee98c63584d8249795b5e4c1e1a75fcc2059b2ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb6c6cb81709dc0b7aa2845e64346621db2cfed45ff16d75cb2384e669cfe8e0497efb8b1d36ea94dbc82da40397347662c118afeaef91347f30b73d93ec940f
|
7
|
+
data.tar.gz: e7eef17ef1e8cab63f79baebba312410455c997c1a5a2128416b48b5bf26c47320c93835e70167b8e218dc022b9171b9d7e802653e205c76dfc81018cfbf3689
|
data/History.md
CHANGED
@@ -4,8 +4,12 @@
|
|
4
4
|
- Log ES response errors (#230)
|
5
5
|
- Use latest elasticsearch-ruby (#240)
|
6
6
|
|
7
|
+
### 2.0.0.rc.5
|
8
|
+
- make configurable with `ssl_version` parameter (#299)
|
9
|
+
- add `logstash_prefix_separator` config parameter (#297)
|
10
|
+
|
7
11
|
### 2.0.0.rc.4
|
8
|
-
- fix license identifier in gemspec
|
12
|
+
- fix license identifier in gemspec (#294)
|
9
13
|
|
10
14
|
### 2.0.0.rc.3
|
11
15
|
- add built-in placeholders support (#288, #293)
|
data/ISSUE_TEMPLATE.md
CHANGED
data/README.md
CHANGED
@@ -21,6 +21,7 @@ Current maintainers: @cosmo0920
|
|
21
21
|
+ [user, password, path, scheme, ssl_verify](#user-password-path-scheme-ssl_verify)
|
22
22
|
+ [logstash_format](#logstash_format)
|
23
23
|
+ [logstash_prefix](#logstash_prefix)
|
24
|
+
+ [logstash_prefix_separator](#logstash_prefix_separator)
|
24
25
|
+ [logstash_dateformat](#logstash_dateformat)
|
25
26
|
+ [pipeline](#pipeline)
|
26
27
|
+ [time_key_format](#time_key_format)
|
@@ -49,7 +50,7 @@ Current maintainers: @cosmo0920
|
|
49
50
|
+ [reconnect_on_error](#reconnect_on_error)
|
50
51
|
+ [Client/host certificate options](#clienthost-certificate-options)
|
51
52
|
+ [Proxy Support](#proxy-support)
|
52
|
-
+ [
|
53
|
+
+ [Buffer options](#buffer-options)
|
53
54
|
+ [Hash flattening](#hash-flattening)
|
54
55
|
+ [Not seeing a config you need?](#not-seeing-a-config-you-need)
|
55
56
|
+ [Dynamic configuration](#dynamic-configuration)
|
@@ -67,6 +68,7 @@ Current maintainers: @cosmo0920
|
|
67
68
|
| < 2.0.0 | >= v0.12.0 | >= 1.9 |
|
68
69
|
|
69
70
|
NOTE: fluent-plugin-elasticsearch v2.0.0 is now RC. We will release stable v2.0.0 soon.
|
71
|
+
|
70
72
|
NOTE: For v0.12 version, you should use 1.x.y version. Please send patch into v0.12 branch if you encountered 1.x version's bug.
|
71
73
|
|
72
74
|
## Installation
|
@@ -136,6 +138,12 @@ This is meant to make writing data into ElasticSearch indices compatible to what
|
|
136
138
|
logstash_prefix mylogs # defaults to "logstash"
|
137
139
|
```
|
138
140
|
|
141
|
+
### logstash_prefix_separator
|
142
|
+
|
143
|
+
```
|
144
|
+
logstash_prefix_separator _ # defaults to "-"
|
145
|
+
```
|
146
|
+
|
139
147
|
### logstash_dateformat
|
140
148
|
|
141
149
|
The strftime format to generate index target index name when `logstash_format` is set to true. By default, the records are inserted into index `logstash-YYYY.MM.DD`. This option, alongwith `logstash_prefix` lets us insert into specified index like `mylogs-YYYYMM` for a monthly index.
|
@@ -455,13 +463,18 @@ client_key /path/to/your/private/key
|
|
455
463
|
client_key_pass password
|
456
464
|
```
|
457
465
|
|
466
|
+
If you want to configure SSL/TLS version, you can specify ssl\_version parameter.
|
467
|
+
```
|
468
|
+
ssl_version TLSv1_2 # or [SSLv23, TLSv1, TLSv1_1]
|
469
|
+
```
|
470
|
+
|
458
471
|
### Proxy Support
|
459
472
|
|
460
473
|
Starting with version 0.8.0, this gem uses excon, which supports proxy with environment variables - https://github.com/excon/excon#proxy-support
|
461
474
|
|
462
|
-
###
|
475
|
+
### Buffer options
|
463
476
|
|
464
|
-
`fluentd-plugin-elasticsearch` extends [Fluentd's builtin
|
477
|
+
`fluentd-plugin-elasticsearch` extends [Fluentd's builtin Output plugin](https://docs.fluentd.org/v0.14/articles/output-plugin-overview) and use `compat_parameters` plugin helper. It adds the following options:
|
465
478
|
|
466
479
|
```
|
467
480
|
buffer_type memory
|
@@ -473,6 +486,8 @@ num_threads 1
|
|
473
486
|
|
474
487
|
The value for option `buffer_chunk_limit` should not exceed value `http.max_content_length` in your Elasticsearch setup (by default it is 100mb).
|
475
488
|
|
489
|
+
**Note**: If you use or evaluate Fluentd v0.14, you can use `<buffer>` directive to specify buffer configuration, too. In more detail, please refer to the [buffer configuration options for v0.14](https://docs.fluentd.org/v0.14/articles/buffer-plugin-overview#configuration-parameters)
|
490
|
+
|
476
491
|
### Hash flattening
|
477
492
|
|
478
493
|
Elasticsearch will complain if you send object and concrete values to the same field. For example, you might have logs that look this, from different places:
|
@@ -512,6 +527,8 @@ Alternatively, consider using [fluent-plugin-forest](https://github.com/tagomori
|
|
512
527
|
|
513
528
|
And yet another option is described in Dynamic Configuration section.
|
514
529
|
|
530
|
+
**Note**: If you use or evaluate Fluentd v0.14, you can use builtin placeholders. In more detail, please refer to [Placeholders](#placeholders) section.
|
531
|
+
|
515
532
|
### Dynamic configuration
|
516
533
|
|
517
534
|
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:
|
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'fluent-plugin-elasticsearch'
|
6
|
-
s.version = '2.0.0.rc.
|
6
|
+
s.version = '2.0.0.rc.5'
|
7
7
|
s.authors = ['diogo', 'pitr']
|
8
8
|
s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com']
|
9
9
|
s.description = %q{ElasticSearch output plugin for Fluent event collector}
|
@@ -35,6 +35,7 @@ module Fluent::Plugin
|
|
35
35
|
config_param :time_precision, :integer, :default => 9
|
36
36
|
config_param :logstash_format, :bool, :default => false
|
37
37
|
config_param :logstash_prefix, :string, :default => "logstash"
|
38
|
+
config_param :logstash_prefix_separator, :string, :default => '-'
|
38
39
|
config_param :logstash_dateformat, :string, :default => "%Y.%m.%d"
|
39
40
|
config_param :utc_index, :bool, :default => true
|
40
41
|
config_param :type_name, :string, :default => "fluentd"
|
@@ -54,6 +55,7 @@ module Fluent::Plugin
|
|
54
55
|
config_param :client_cert, :string, :default => nil
|
55
56
|
config_param :client_key_pass, :string, :default => nil
|
56
57
|
config_param :ca_file, :string, :default => nil
|
58
|
+
config_param :ssl_version, :enum, list: [:SSLv23, :TLSv1, :TLSv1_1, :TLSv1_2], :default => :TLSv1
|
57
59
|
config_param :remove_keys, :string, :default => nil
|
58
60
|
config_param :remove_keys_on_update, :string, :default => ""
|
59
61
|
config_param :remove_keys_on_update_key, :string, :default => nil
|
@@ -170,7 +172,7 @@ module Fluent::Plugin
|
|
170
172
|
transport_options: {
|
171
173
|
headers: { 'Content-Type' => 'application/json' },
|
172
174
|
request: { timeout: @request_timeout },
|
173
|
-
ssl: { verify: @ssl_verify, ca_file: @ca_file }
|
175
|
+
ssl: { verify: @ssl_verify, ca_file: @ca_file, version: @ssl_version }
|
174
176
|
}
|
175
177
|
}), &adapter_conf)
|
176
178
|
es = Elasticsearch::Client.new transport: transport
|
@@ -334,7 +336,7 @@ module Fluent::Plugin
|
|
334
336
|
record[TIMESTAMP_FIELD] = dt.iso8601(@time_precision)
|
335
337
|
end
|
336
338
|
dt = dt.new_offset(0) if @utc_index
|
337
|
-
target_index = "#{logstash_prefix}
|
339
|
+
target_index = "#{logstash_prefix}#{@logstash_prefix_separator}#{dt.strftime(@logstash_dateformat)}"
|
338
340
|
else
|
339
341
|
target_index = index_name
|
340
342
|
end
|
@@ -74,6 +74,10 @@ class ElasticsearchOutput < Test::Unit::TestCase
|
|
74
74
|
assert_equal '/es/', instance.path
|
75
75
|
assert_equal 'john', instance.user
|
76
76
|
assert_equal 'doe', instance.password
|
77
|
+
assert_equal :TLSv1, instance.ssl_version
|
78
|
+
assert_nil instance.client_key
|
79
|
+
assert_nil instance.client_cert
|
80
|
+
assert_nil instance.client_key_pass
|
77
81
|
end
|
78
82
|
|
79
83
|
test 'lack of tag in chunk_keys' do
|
@@ -748,6 +752,21 @@ class ElasticsearchOutput < Test::Unit::TestCase
|
|
748
752
|
assert_equal(logstash_index, index_cmds.first['index']['_index'])
|
749
753
|
end
|
750
754
|
|
755
|
+
def test_writes_to_logstash_index_with_specified_prefix_and_separator
|
756
|
+
separator = '_'
|
757
|
+
driver.configure("logstash_format true
|
758
|
+
logstash_prefix_separator #{separator}
|
759
|
+
logstash_prefix myprefix")
|
760
|
+
time = Time.parse Date.today.to_s
|
761
|
+
logstash_index = "myprefix#{separator}#{time.getutc.strftime("%Y.%m.%d")}"
|
762
|
+
stub_elastic_ping
|
763
|
+
stub_elastic
|
764
|
+
driver.run(default_tag: 'test') do
|
765
|
+
driver.feed(time.to_i, sample_record)
|
766
|
+
end
|
767
|
+
assert_equal(logstash_index, index_cmds.first['index']['_index'])
|
768
|
+
end
|
769
|
+
|
751
770
|
class LogStashPrefixPlaceholdersTest < self
|
752
771
|
def test_writes_to_logstash_index_with_specified_prefix_and_tag_placeholder
|
753
772
|
driver.configure("logstash_format true
|
@@ -69,6 +69,10 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
|
|
69
69
|
assert_equal 'john', instance.user
|
70
70
|
assert_equal 'doe', instance.password
|
71
71
|
assert_equal '/es/', instance.path
|
72
|
+
assert_equal :TLSv1, instance.ssl_version
|
73
|
+
assert_nil instance.client_key
|
74
|
+
assert_nil instance.client_cert
|
75
|
+
assert_nil instance.client_key_pass
|
72
76
|
end
|
73
77
|
|
74
78
|
def test_defaults
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.rc.
|
4
|
+
version: 2.0.0.rc.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- diogo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-09-
|
12
|
+
date: 2017-09-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|