fluent-plugin-elasticsearch 3.5.3 → 3.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +2 -2
- data/.editorconfig +9 -9
- data/.gitignore +18 -18
- data/.travis.yml +18 -18
- data/Gemfile +9 -9
- data/History.md +390 -384
- data/ISSUE_TEMPLATE.md +27 -27
- data/LICENSE.txt +201 -201
- data/PULL_REQUEST_TEMPLATE.md +10 -10
- data/README.md +1515 -1398
- data/Rakefile +11 -11
- data/appveyor.yml +30 -30
- data/fluent-plugin-elasticsearch.gemspec +31 -31
- data/lib/fluent/log-ext.rb +38 -38
- data/lib/fluent/plugin/elasticsearch_constants.rb +13 -13
- data/lib/fluent/plugin/elasticsearch_error.rb +5 -5
- data/lib/fluent/plugin/elasticsearch_error_handler.rb +122 -122
- data/lib/fluent/plugin/elasticsearch_index_template.rb +112 -110
- data/lib/fluent/plugin/elasticsearch_simple_sniffer.rb +10 -10
- data/lib/fluent/plugin/filter_elasticsearch_genid.rb +25 -25
- data/lib/fluent/plugin/oj_serializer.rb +22 -22
- data/lib/fluent/plugin/out_elasticsearch.rb +777 -776
- data/lib/fluent/plugin/out_elasticsearch_dynamic.rb +262 -262
- data/test/helper.rb +24 -24
- data/test/plugin/test_alias_template.json +8 -8
- data/test/plugin/test_elasticsearch_error_handler.rb +503 -503
- data/test/plugin/test_filter_elasticsearch_genid.rb +44 -44
- data/test/plugin/test_out_elasticsearch.rb +2720 -2720
- data/test/plugin/test_out_elasticsearch_dynamic.rb +1001 -1001
- data/test/plugin/test_template.json +23 -23
- data/test/test_log-ext.rb +35 -35
- metadata +4 -3
data/PULL_REQUEST_TEMPLATE.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
DESCRIPTION HERE
|
2
|
-
|
3
|
-
(check all that apply)
|
4
|
-
- [ ] tests added
|
5
|
-
- [ ] tests passing
|
6
|
-
- [ ] README updated (if needed)
|
7
|
-
- [ ] README Table of Contents updated (if needed)
|
8
|
-
- [ ] History.md and `version` in gemspec are untouched
|
9
|
-
- [ ] backward compatible
|
10
|
-
- [ ] feature works in `elasticsearch_dynamic` (not required but recommended)
|
1
|
+
DESCRIPTION HERE
|
2
|
+
|
3
|
+
(check all that apply)
|
4
|
+
- [ ] tests added
|
5
|
+
- [ ] tests passing
|
6
|
+
- [ ] README updated (if needed)
|
7
|
+
- [ ] README Table of Contents updated (if needed)
|
8
|
+
- [ ] History.md and `version` in gemspec are untouched
|
9
|
+
- [ ] backward compatible
|
10
|
+
- [ ] feature works in `elasticsearch_dynamic` (not required but recommended)
|
data/README.md
CHANGED
@@ -1,1398 +1,1515 @@
|
|
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
|
-
|
8
|
-
Send your logs to Elasticsearch (and search them with Kibana maybe?)
|
9
|
-
|
10
|
-
Note: For Amazon Elasticsearch Service please consider using [fluent-plugin-aws-elasticsearch-service](https://github.com/atomita/fluent-plugin-aws-elasticsearch-service)
|
11
|
-
|
12
|
-
Current maintainers: @cosmo0920
|
13
|
-
|
14
|
-
* [Installation](#installation)
|
15
|
-
* [Usage](#usage)
|
16
|
-
+ [Index templates](#index-templates)
|
17
|
-
* [Configuration](#configuration)
|
18
|
-
+ [host](#host)
|
19
|
-
+ [emit_error_for_missing_id](#emit_error_for_missing_id)
|
20
|
-
+ [hosts](#hosts)
|
21
|
-
+ [user, password, path, scheme, ssl_verify](#user-password-path-scheme-ssl_verify)
|
22
|
-
+ [logstash_format](#logstash_format)
|
23
|
-
+ [logstash_prefix](#logstash_prefix)
|
24
|
-
+ [logstash_prefix_separator](#logstash_prefix_separator)
|
25
|
-
+ [logstash_dateformat](#logstash_dateformat)
|
26
|
-
+ [pipeline](#pipeline)
|
27
|
-
+ [time_key_format](#time_key_format)
|
28
|
-
+ [time_precision](#time_precision)
|
29
|
-
+ [time_key](#time_key)
|
30
|
-
+ [time_key_exclude_timestamp](#time_key_exclude_timestamp)
|
31
|
-
+ [include_timestamp](#include_timestamp)
|
32
|
-
+ [utc_index](#utc_index)
|
33
|
-
+ [target_index_key](#target_index_key)
|
34
|
-
+ [target_type_key](#target_type_key)
|
35
|
-
+ [template_name](#template_name)
|
36
|
-
+ [template_file](#template_file)
|
37
|
-
+ [template_overwrite](#template_overwrite)
|
38
|
-
+ [customize_template](#customize_template)
|
39
|
-
+ [rollover_index](#rollover_index)
|
40
|
-
+ [index_date_pattern](#index_date_pattern)
|
41
|
-
+ [deflector_alias](#deflector_alias)
|
42
|
-
+ [application_name](#application_name)
|
43
|
-
+ [index_prefix](#index_prefix)
|
44
|
-
+ [templates](#templates)
|
45
|
-
+ [max_retry_putting_template](#max_retry_putting_template)
|
46
|
-
+ [fail_on_putting_template_retry_exceed](#fail_on_putting_template_retry_exceed)
|
47
|
-
+ [max_retry_get_es_version](#max_retry_get_es_version)
|
48
|
-
+ [request_timeout](#request_timeout)
|
49
|
-
+ [reload_connections](#reload_connections)
|
50
|
-
+ [reload_on_failure](#reload_on_failure)
|
51
|
-
+ [resurrect_after](#resurrect_after)
|
52
|
-
+ [include_tag_key, tag_key](#include_tag_key-tag_key)
|
53
|
-
+ [id_key](#id_key)
|
54
|
-
+ [parent_key](#parent_key)
|
55
|
-
+ [routing_key](#routing_key)
|
56
|
-
+ [remove_keys](#remove_keys)
|
57
|
-
+ [remove_keys_on_update](#remove_keys_on_update)
|
58
|
-
+ [remove_keys_on_update_key](#remove_keys_on_update_key)
|
59
|
-
+ [retry_tag](#retry_tag)
|
60
|
-
+ [write_operation](#write_operation)
|
61
|
-
+ [time_parse_error_tag](#time_parse_error_tag)
|
62
|
-
+ [reconnect_on_error](#reconnect_on_error)
|
63
|
-
+ [with_transporter_log](#with_transporter_log)
|
64
|
-
+ [content_type](#content_type)
|
65
|
-
+ [include_index_in_url](#include_index_in_url)
|
66
|
-
+ [http_backend](#http_backend)
|
67
|
-
+ [prefer_oj_serializer](#prefer_oj_serializer)
|
68
|
-
+ [Client/host certificate options](#clienthost-certificate-options)
|
69
|
-
+ [Proxy Support](#proxy-support)
|
70
|
-
+ [Buffer options](#buffer-options)
|
71
|
-
+ [Hash flattening](#hash-flattening)
|
72
|
-
+ [Generate Hash ID](#generate-hash-id)
|
73
|
-
+ [sniffer_class_name](#sniffer-class-name)
|
74
|
-
+ [reload_after](#reload-after)
|
75
|
-
+ [validate_client_version](#validate-client-version)
|
76
|
-
+ [unrecoverable_error_types](#unrecoverable-error-types)
|
77
|
-
+ [verify_es version at startup](#verify_es_version_at_startup)
|
78
|
-
+ [default_elasticsearch_version](#default_elasticsearch_version)
|
79
|
-
+ [custom_headers](#custom_headers)
|
80
|
-
+ [Not seeing a config you need?](#not-seeing-a-config-you-need)
|
81
|
-
+ [Dynamic configuration](#dynamic-configuration)
|
82
|
-
+ [Placeholders](#placeholders)
|
83
|
-
+ [Multi workers](#multi-workers)
|
84
|
-
+ [log_es_400_reason](#log_es_400_reason)
|
85
|
-
+ [suppress_doc_wrap](#suppress_doc_wrap)
|
86
|
-
+ [ignore_exceptions](#ignore_exceptions)
|
87
|
-
+ [exception_backup](#exception_backup)
|
88
|
-
+ [bulk_message_request_threshold](#bulk_message_request_threshold)
|
89
|
-
* [Troubleshooting](#troubleshooting)
|
90
|
-
+ [Cannot send events to elasticsearch](#cannot-send-events-to-elasticsearch)
|
91
|
-
+ [Cannot see detailed failure log](#cannot-see-detailed-failure-log)
|
92
|
-
+ [Cannot connect TLS enabled reverse Proxy](#cannot-connect-tls-enabled-reverse-proxy)
|
93
|
-
+ [Declined logs are resubmitted forever, why?](#declined-logs-are-resubmitted-forever-why)
|
94
|
-
+ [Suggested to increase flush_thread_count, why?](#suggested-to-increase-flush_thread_count-why)
|
95
|
-
+ [Suggested to install typhoeus gem, why?](#suggested-to-install-typhoeus-gem-why)
|
96
|
-
+ [Stopped to send events on k8s, why?](#stopped-to-send-events-on-k8s-why)
|
97
|
-
|
98
|
-
|
99
|
-
* [
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
NOTE:
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
```
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
```
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
```
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
```
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
**Note:**
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
```
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
```
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
```
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
```
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
```
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
```
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
```
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
```
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
"
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
```
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
```
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
"
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
```
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
```
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
```
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
```
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
```
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
```
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
```
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
```
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
```
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
```
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
```
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
```
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
```
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
```
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
```
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
```
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
```
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
This
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
```
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
```
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
```
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
```
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
```
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
```
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
```
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
```
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
```
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
```
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
records
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
```
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
```
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
```
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
```
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
```
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
```
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
```
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
```
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
**Note**: If you use
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
#
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
```
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
```
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
```
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
```
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
They
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
</
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
</
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
```
|
1016
|
-
|
1017
|
-
```
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
</
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
```
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
# For
|
1088
|
-
$
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
```
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
```
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
```
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
add_header
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]:
|
1186
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]:
|
1187
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/connection.rb:
|
1188
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/
|
1189
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/
|
1190
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/
|
1191
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/
|
1192
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/base.rb:16:in `request_call'
|
1193
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]:
|
1194
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/
|
1195
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]:
|
1196
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/
|
1197
|
-
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/bin/fluentd:
|
1198
|
-
Oct 31 9:44:45 <ES-Host>
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
```
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
```
|
1321
|
-
|
1322
|
-
```
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
If you use
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
```
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
```
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
* `
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
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
|
+
|
8
|
+
Send your logs to Elasticsearch (and search them with Kibana maybe?)
|
9
|
+
|
10
|
+
Note: For Amazon Elasticsearch Service please consider using [fluent-plugin-aws-elasticsearch-service](https://github.com/atomita/fluent-plugin-aws-elasticsearch-service)
|
11
|
+
|
12
|
+
Current maintainers: @cosmo0920
|
13
|
+
|
14
|
+
* [Installation](#installation)
|
15
|
+
* [Usage](#usage)
|
16
|
+
+ [Index templates](#index-templates)
|
17
|
+
* [Configuration](#configuration)
|
18
|
+
+ [host](#host)
|
19
|
+
+ [emit_error_for_missing_id](#emit_error_for_missing_id)
|
20
|
+
+ [hosts](#hosts)
|
21
|
+
+ [user, password, path, scheme, ssl_verify](#user-password-path-scheme-ssl_verify)
|
22
|
+
+ [logstash_format](#logstash_format)
|
23
|
+
+ [logstash_prefix](#logstash_prefix)
|
24
|
+
+ [logstash_prefix_separator](#logstash_prefix_separator)
|
25
|
+
+ [logstash_dateformat](#logstash_dateformat)
|
26
|
+
+ [pipeline](#pipeline)
|
27
|
+
+ [time_key_format](#time_key_format)
|
28
|
+
+ [time_precision](#time_precision)
|
29
|
+
+ [time_key](#time_key)
|
30
|
+
+ [time_key_exclude_timestamp](#time_key_exclude_timestamp)
|
31
|
+
+ [include_timestamp](#include_timestamp)
|
32
|
+
+ [utc_index](#utc_index)
|
33
|
+
+ [target_index_key](#target_index_key)
|
34
|
+
+ [target_type_key](#target_type_key)
|
35
|
+
+ [template_name](#template_name)
|
36
|
+
+ [template_file](#template_file)
|
37
|
+
+ [template_overwrite](#template_overwrite)
|
38
|
+
+ [customize_template](#customize_template)
|
39
|
+
+ [rollover_index](#rollover_index)
|
40
|
+
+ [index_date_pattern](#index_date_pattern)
|
41
|
+
+ [deflector_alias](#deflector_alias)
|
42
|
+
+ [application_name](#application_name)
|
43
|
+
+ [index_prefix](#index_prefix)
|
44
|
+
+ [templates](#templates)
|
45
|
+
+ [max_retry_putting_template](#max_retry_putting_template)
|
46
|
+
+ [fail_on_putting_template_retry_exceed](#fail_on_putting_template_retry_exceed)
|
47
|
+
+ [max_retry_get_es_version](#max_retry_get_es_version)
|
48
|
+
+ [request_timeout](#request_timeout)
|
49
|
+
+ [reload_connections](#reload_connections)
|
50
|
+
+ [reload_on_failure](#reload_on_failure)
|
51
|
+
+ [resurrect_after](#resurrect_after)
|
52
|
+
+ [include_tag_key, tag_key](#include_tag_key-tag_key)
|
53
|
+
+ [id_key](#id_key)
|
54
|
+
+ [parent_key](#parent_key)
|
55
|
+
+ [routing_key](#routing_key)
|
56
|
+
+ [remove_keys](#remove_keys)
|
57
|
+
+ [remove_keys_on_update](#remove_keys_on_update)
|
58
|
+
+ [remove_keys_on_update_key](#remove_keys_on_update_key)
|
59
|
+
+ [retry_tag](#retry_tag)
|
60
|
+
+ [write_operation](#write_operation)
|
61
|
+
+ [time_parse_error_tag](#time_parse_error_tag)
|
62
|
+
+ [reconnect_on_error](#reconnect_on_error)
|
63
|
+
+ [with_transporter_log](#with_transporter_log)
|
64
|
+
+ [content_type](#content_type)
|
65
|
+
+ [include_index_in_url](#include_index_in_url)
|
66
|
+
+ [http_backend](#http_backend)
|
67
|
+
+ [prefer_oj_serializer](#prefer_oj_serializer)
|
68
|
+
+ [Client/host certificate options](#clienthost-certificate-options)
|
69
|
+
+ [Proxy Support](#proxy-support)
|
70
|
+
+ [Buffer options](#buffer-options)
|
71
|
+
+ [Hash flattening](#hash-flattening)
|
72
|
+
+ [Generate Hash ID](#generate-hash-id)
|
73
|
+
+ [sniffer_class_name](#sniffer-class-name)
|
74
|
+
+ [reload_after](#reload-after)
|
75
|
+
+ [validate_client_version](#validate-client-version)
|
76
|
+
+ [unrecoverable_error_types](#unrecoverable-error-types)
|
77
|
+
+ [verify_es version at startup](#verify_es_version_at_startup)
|
78
|
+
+ [default_elasticsearch_version](#default_elasticsearch_version)
|
79
|
+
+ [custom_headers](#custom_headers)
|
80
|
+
+ [Not seeing a config you need?](#not-seeing-a-config-you-need)
|
81
|
+
+ [Dynamic configuration](#dynamic-configuration)
|
82
|
+
+ [Placeholders](#placeholders)
|
83
|
+
+ [Multi workers](#multi-workers)
|
84
|
+
+ [log_es_400_reason](#log_es_400_reason)
|
85
|
+
+ [suppress_doc_wrap](#suppress_doc_wrap)
|
86
|
+
+ [ignore_exceptions](#ignore_exceptions)
|
87
|
+
+ [exception_backup](#exception_backup)
|
88
|
+
+ [bulk_message_request_threshold](#bulk_message_request_threshold)
|
89
|
+
* [Troubleshooting](#troubleshooting)
|
90
|
+
+ [Cannot send events to elasticsearch](#cannot-send-events-to-elasticsearch)
|
91
|
+
+ [Cannot see detailed failure log](#cannot-see-detailed-failure-log)
|
92
|
+
+ [Cannot connect TLS enabled reverse Proxy](#cannot-connect-tls-enabled-reverse-proxy)
|
93
|
+
+ [Declined logs are resubmitted forever, why?](#declined-logs-are-resubmitted-forever-why)
|
94
|
+
+ [Suggested to increase flush_thread_count, why?](#suggested-to-increase-flush_thread_count-why)
|
95
|
+
+ [Suggested to install typhoeus gem, why?](#suggested-to-install-typhoeus-gem-why)
|
96
|
+
+ [Stopped to send events on k8s, why?](#stopped-to-send-events-on-k8s-why)
|
97
|
+
+ [Random 400 - Rejected by Elasticsearch is occured, why?](#random-400---rejected-by-elasticsearch-is-occured-why)
|
98
|
+
+ [Fluentd seems to hang if it unable to connect Elasticsearch, why?](#fluentd-seems-to-hang-if-it-unable-to-connect-elasticsearch-why)
|
99
|
+
* [Contact](#contact)
|
100
|
+
* [Contributing](#contributing)
|
101
|
+
* [Running tests](#running-tests)
|
102
|
+
|
103
|
+
## Requirements
|
104
|
+
|
105
|
+
| fluent-plugin-elasticsearch | fluentd | ruby |
|
106
|
+
|-------------------|---------|------|
|
107
|
+
| >= 2.0.0 | >= v0.14.20 | >= 2.1 |
|
108
|
+
| < 2.0.0 | >= v0.12.0 | >= 1.9 |
|
109
|
+
|
110
|
+
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.
|
111
|
+
|
112
|
+
NOTE: This documentation is for fluent-plugin-elasticsearch 2.x or later. For 1.x documentation, please see [v0.12 branch](https://github.com/uken/fluent-plugin-elasticsearch/tree/v0.12).
|
113
|
+
|
114
|
+
## Installation
|
115
|
+
|
116
|
+
```sh
|
117
|
+
$ gem install fluent-plugin-elasticsearch
|
118
|
+
```
|
119
|
+
|
120
|
+
## Usage
|
121
|
+
|
122
|
+
In your Fluentd configuration, use `@type elasticsearch`. Additional configuration is optional, default values would look like this:
|
123
|
+
|
124
|
+
```
|
125
|
+
<match my.logs>
|
126
|
+
@type elasticsearch
|
127
|
+
host localhost
|
128
|
+
port 9200
|
129
|
+
index_name fluentd
|
130
|
+
type_name fluentd
|
131
|
+
</match>
|
132
|
+
```
|
133
|
+
|
134
|
+
### Index templates
|
135
|
+
|
136
|
+
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.
|
137
|
+
|
138
|
+
## Configuration
|
139
|
+
|
140
|
+
### host
|
141
|
+
|
142
|
+
```
|
143
|
+
host user-custom-host.domain # default localhost
|
144
|
+
```
|
145
|
+
|
146
|
+
You can specify Elasticsearch host by this parameter.
|
147
|
+
|
148
|
+
**Note:** Since v3.3.2, `host` parameter supports builtin placeholders. If you want to send events dynamically into different hosts at runtime with `elasticsearch_dynamic` output plugin, please consider to switch to use plain `elasticsearch` output plugin. In more detail for builtin placeholders, please refer to [Placeholders](#placeholders) section.
|
149
|
+
|
150
|
+
### emit_error_for_missing_id
|
151
|
+
|
152
|
+
```
|
153
|
+
emit_error_for_missing_id true
|
154
|
+
```
|
155
|
+
When `write_operation` is configured to anything other then `index`, setting this value to `true` will
|
156
|
+
cause the plugin to `emit_error_event` of any records which do not include an `_id` field. The default (`false`)
|
157
|
+
behavior is to silently drop the records.
|
158
|
+
|
159
|
+
### hosts
|
160
|
+
|
161
|
+
```
|
162
|
+
hosts host1:port1,host2:port2,host3:port3
|
163
|
+
```
|
164
|
+
|
165
|
+
You can specify multiple Elasticsearch hosts with separator ",".
|
166
|
+
|
167
|
+
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.
|
168
|
+
|
169
|
+
**Note:** If you will use scheme https, do not include "https://" in your hosts ie. host "https://domain", this will cause ES cluster to be unreachable and you will receive an error "Can not reach Elasticsearch cluster"
|
170
|
+
|
171
|
+
**Note:** Up until v2.8.5, it was allowed to embed the username/password in the URL. However, this syntax is deprecated as of v2.8.6 because it was found to cause serious connection problems (See #394). Please migrate your settings to use the `user` and `password` field (described below) instead.
|
172
|
+
|
173
|
+
### user, password, path, scheme, ssl_verify
|
174
|
+
|
175
|
+
If you specify this option, port options are ignored.
|
176
|
+
|
177
|
+
```
|
178
|
+
user demo
|
179
|
+
password secret
|
180
|
+
path /elastic_search/
|
181
|
+
scheme https
|
182
|
+
```
|
183
|
+
|
184
|
+
You can specify user and password for HTTP Basic authentication.
|
185
|
+
|
186
|
+
And this plugin will escape required URL encoded characters within `%{}` placeholders.
|
187
|
+
|
188
|
+
```
|
189
|
+
user %{demo+}
|
190
|
+
password %{@secret}
|
191
|
+
```
|
192
|
+
|
193
|
+
Specify `ssl_verify false` to skip ssl verification (defaults to true)
|
194
|
+
|
195
|
+
### logstash_format
|
196
|
+
|
197
|
+
```
|
198
|
+
logstash_format true # defaults to false
|
199
|
+
```
|
200
|
+
|
201
|
+
This is meant to make writing data into Elasticsearch indices compatible to what [Logstash](https://www.elastic.co/products/logstash) calls them. By doing this, one could take advantage of [Kibana](https://www.elastic.co/products/kibana). See logstash_prefix and logstash_dateformat to customize this index name pattern. The index name will be `#{logstash_prefix}-#{formatted_date}`
|
202
|
+
|
203
|
+
:warning: Setting this option to `true` will ignore the `index_name` setting. The default index name prefix is `logstash-`.
|
204
|
+
|
205
|
+
### include_timestamp
|
206
|
+
|
207
|
+
```
|
208
|
+
include_timestamp true # defaults to false
|
209
|
+
```
|
210
|
+
|
211
|
+
Adds a `@timestamp` field to the log, following all settings `logstash_format` does, except without the restrictions on `index_name`. This allows one to log to an alias in Elasticsearch and utilize the rollover API.
|
212
|
+
|
213
|
+
### logstash_prefix
|
214
|
+
|
215
|
+
```
|
216
|
+
logstash_prefix mylogs # defaults to "logstash"
|
217
|
+
```
|
218
|
+
|
219
|
+
### logstash_prefix_separator
|
220
|
+
|
221
|
+
```
|
222
|
+
logstash_prefix_separator _ # defaults to "-"
|
223
|
+
```
|
224
|
+
|
225
|
+
### logstash_dateformat
|
226
|
+
|
227
|
+
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.
|
228
|
+
|
229
|
+
```
|
230
|
+
logstash_dateformat %Y.%m. # defaults to "%Y.%m.%d"
|
231
|
+
```
|
232
|
+
|
233
|
+
### pipeline
|
234
|
+
|
235
|
+
Only in ES >= 5.x is available to use this parameter.
|
236
|
+
This param is to set a pipeline id of your elasticsearch to be added into the request, you can configure ingest node.
|
237
|
+
For more information: [![Ingest node](https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html)]
|
238
|
+
|
239
|
+
```
|
240
|
+
pipeline pipeline_id
|
241
|
+
```
|
242
|
+
|
243
|
+
### time_key_format
|
244
|
+
|
245
|
+
The format of the time stamp field (`@timestamp` or what you specify with [time_key](#time_key)). This parameter only has an effect when [logstash_format](#logstash_format) is true as it only affects the name of the index we write to. Please see [Time#strftime](http://ruby-doc.org/core-1.9.3/Time.html#method-i-strftime) for information about the value of this format.
|
246
|
+
|
247
|
+
Setting this to a known format can vastly improve your log ingestion speed if all most of your logs are in the same format. If there is an error parsing this format the timestamp will default to the ingestion time. If you are on Ruby 2.0 or later you can get a further performance improvement by installing the "strptime" gem: `fluent-gem install strptime`.
|
248
|
+
|
249
|
+
For example to parse ISO8601 times with sub-second precision:
|
250
|
+
|
251
|
+
```
|
252
|
+
time_key_format %Y-%m-%dT%H:%M:%S.%N%z
|
253
|
+
```
|
254
|
+
|
255
|
+
### time_precision
|
256
|
+
|
257
|
+
Should the record not include a `time_key`, define the degree of sub-second time precision to preserve from the `time` portion of the routed event.
|
258
|
+
|
259
|
+
For example, should your input plugin not include a `time_key` in the record but it able to pass a `time` to the router when emitting the event (AWS CloudWatch events are an example of this), then this setting will allow you to preserve the sub-second time resolution of those events. This is the case for: [fluent-plugin-cloudwatch-ingest](https://github.com/sampointer/fluent-plugin-cloudwatch-ingest).
|
260
|
+
|
261
|
+
### time_key
|
262
|
+
|
263
|
+
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.
|
264
|
+
|
265
|
+
```
|
266
|
+
{"@timestamp": "2014-04-07T000:00:00-00:00"}
|
267
|
+
```
|
268
|
+
|
269
|
+
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.
|
270
|
+
|
271
|
+
Suppose you have settings
|
272
|
+
|
273
|
+
```
|
274
|
+
logstash_format true
|
275
|
+
time_key vtm
|
276
|
+
```
|
277
|
+
|
278
|
+
Your input is:
|
279
|
+
```
|
280
|
+
{
|
281
|
+
"title": "developer",
|
282
|
+
"vtm": "2014-12-19T08:01:03Z"
|
283
|
+
}
|
284
|
+
```
|
285
|
+
|
286
|
+
The output will be
|
287
|
+
```
|
288
|
+
{
|
289
|
+
"title": "developer",
|
290
|
+
"@timestamp": "2014-12-19T08:01:03Z",
|
291
|
+
"vtm": "2014-12-19T08:01:03Z"
|
292
|
+
}
|
293
|
+
```
|
294
|
+
|
295
|
+
See `time_key_exclude_timestamp` to avoid adding `@timestamp`.
|
296
|
+
|
297
|
+
### time_key_exclude_timestamp
|
298
|
+
|
299
|
+
```
|
300
|
+
time_key_exclude_timestamp false
|
301
|
+
```
|
302
|
+
|
303
|
+
By default, setting `time_key` will copy the value to an additional field `@timestamp`. When setting `time_key_exclude_timestamp true`, no additional field will be added.
|
304
|
+
|
305
|
+
### utc_index
|
306
|
+
|
307
|
+
```
|
308
|
+
utc_index true
|
309
|
+
```
|
310
|
+
|
311
|
+
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.
|
312
|
+
|
313
|
+
### target_index_key
|
314
|
+
|
315
|
+
Tell this plugin to find the index name to write to in the record under this key in preference to other mechanisms. Key can be specified as path to nested record using dot ('.') as a separator.
|
316
|
+
|
317
|
+
If it is present in the record (and the value is non falsy) the value will be used as the index name to write to and then removed from the record before output; if it is not found then it will use logstash_format or index_name settings as configured.
|
318
|
+
|
319
|
+
Suppose you have the following settings
|
320
|
+
|
321
|
+
```
|
322
|
+
target_index_key @target_index
|
323
|
+
index_name fallback
|
324
|
+
```
|
325
|
+
|
326
|
+
If your input is:
|
327
|
+
```
|
328
|
+
{
|
329
|
+
"title": "developer",
|
330
|
+
"@timestamp": "2014-12-19T08:01:03Z",
|
331
|
+
"@target_index": "logstash-2014.12.19"
|
332
|
+
}
|
333
|
+
```
|
334
|
+
|
335
|
+
The output would be
|
336
|
+
|
337
|
+
```
|
338
|
+
{
|
339
|
+
"title": "developer",
|
340
|
+
"@timestamp": "2014-12-19T08:01:03Z",
|
341
|
+
}
|
342
|
+
```
|
343
|
+
|
344
|
+
and this record will be written to the specified index (`logstash-2014.12.19`) rather than `fallback`.
|
345
|
+
|
346
|
+
### target_type_key
|
347
|
+
|
348
|
+
Similar to `target_index_key` config, find the type name to write to in the record under this key (or nested record). If key not found in record - fallback to `type_name` (default "fluentd").
|
349
|
+
|
350
|
+
### template_name
|
351
|
+
|
352
|
+
The name of the template to define. If a template by the name given is already present, it will be left unchanged, unless [template_overwrite](#template_overwrite) is set, in which case the template will be updated.
|
353
|
+
|
354
|
+
This parameter along with template_file allow the plugin to behave similarly to Logstash (it installs a template at creation time) so that raw records are available. See [https://github.com/uken/fluent-plugin-elasticsearch/issues/33](https://github.com/uken/fluent-plugin-elasticsearch/issues/33).
|
355
|
+
|
356
|
+
[template_file](#template_file) must also be specified.
|
357
|
+
|
358
|
+
### template_file
|
359
|
+
|
360
|
+
The path to the file containing the template to install.
|
361
|
+
|
362
|
+
[template_name](#template_name) must also be specified.
|
363
|
+
|
364
|
+
### templates
|
365
|
+
|
366
|
+
Specify index templates in form of hash. Can contain multiple templates.
|
367
|
+
|
368
|
+
```
|
369
|
+
templates { "template_name_1": "path_to_template_1_file", "template_name_2": "path_to_template_2_file"}
|
370
|
+
```
|
371
|
+
|
372
|
+
If `template_file` and `template_name` are set, then this parameter will be ignored.
|
373
|
+
|
374
|
+
### customize_template
|
375
|
+
|
376
|
+
Specify the string and its value to be replaced in form of hash. Can contain multiple key value pair that would be replaced in the specified template_file.
|
377
|
+
This setting only creates template and to add rollover index please check the [rollover_index](#rollover_index) configuration.
|
378
|
+
|
379
|
+
```
|
380
|
+
customize_template {"string_1": "subs_value_1", "string_2": "subs_value_2"}
|
381
|
+
```
|
382
|
+
|
383
|
+
If [template_file](#template_file) and [template_name](#template_name) are set, then this parameter will be in effect otherwise ignored.
|
384
|
+
|
385
|
+
### rollover_index
|
386
|
+
|
387
|
+
Specify this as true when an index with rollover capability needs to be created. It creates an index with the format <logstash-default-{now/d}-000001> where logstash denotes the index_prefix and default denotes the application_name which can be set.
|
388
|
+
'deflector_alias' is a required field for rollover_index set to true.
|
389
|
+
'index_prefix' and 'application_name' are optional and defaults to logstash and default respectively.
|
390
|
+
```
|
391
|
+
rollover_index true # defaults to false
|
392
|
+
```
|
393
|
+
|
394
|
+
If [customize_template](#customize_template) is set, then this parameter will be in effect otherwise ignored.
|
395
|
+
|
396
|
+
### index_date_pattern
|
397
|
+
|
398
|
+
Specify this to override the index date pattern for creating a rollover index. The default is to use "now/d",
|
399
|
+
for example: <logstash-default-{now/d}-000001>. Overriding this changes the rollover time period. Setting
|
400
|
+
"now/w{xxxx.ww}" would create weekly rollover indexes instead of daily.
|
401
|
+
|
402
|
+
This setting only takes effect when combined with the [rollover_index](#rollover_index) setting.
|
403
|
+
```
|
404
|
+
index_date_pattern "now/w{xxxx.ww}" # defaults to "now/d"
|
405
|
+
```
|
406
|
+
|
407
|
+
If [customize_template](#customize_template) is set, then this parameter will be in effect otherwise ignored.
|
408
|
+
|
409
|
+
### deflector_alias
|
410
|
+
|
411
|
+
Specify the deflector alias which would be assigned to the rollover index created. This is useful in case of using the Elasticsearch rollover API
|
412
|
+
```
|
413
|
+
deflector_alias test-current
|
414
|
+
```
|
415
|
+
|
416
|
+
If [rollover_index](#rollover_index) is set, then this parameter will be in effect otherwise ignored.
|
417
|
+
|
418
|
+
### index_prefix
|
419
|
+
|
420
|
+
Specify the index prefix for the rollover index to be created.
|
421
|
+
```
|
422
|
+
index_prefix mylogs # defaults to "logstash"
|
423
|
+
```
|
424
|
+
|
425
|
+
If [rollover_index](#rollover_index) is set, then this parameter will be in effect otherwise ignored.
|
426
|
+
|
427
|
+
### application_name
|
428
|
+
|
429
|
+
Specify the application name for the rollover index to be created.
|
430
|
+
```
|
431
|
+
application_name default # defaults to "default"
|
432
|
+
```
|
433
|
+
|
434
|
+
If [rollover_index](#rollover_index) is set, then this parameter will be in effect otherwise ignored.
|
435
|
+
|
436
|
+
### template_overwrite
|
437
|
+
|
438
|
+
Always update the template, even if it already exists.
|
439
|
+
|
440
|
+
```
|
441
|
+
template_overwrite true # defaults to false
|
442
|
+
```
|
443
|
+
|
444
|
+
One of [template_file](#template_file) or [templates](#templates) must also be specified if this is set.
|
445
|
+
|
446
|
+
### max_retry_putting_template
|
447
|
+
|
448
|
+
You can specify times of retry putting template.
|
449
|
+
|
450
|
+
This is useful when Elasticsearch plugin cannot connect Elasticsearch to put template.
|
451
|
+
Usually, booting up clustered Elasticsearch containers are much slower than launching Fluentd container.
|
452
|
+
|
453
|
+
```
|
454
|
+
max_retry_putting_template 15 # defaults to 10
|
455
|
+
```
|
456
|
+
|
457
|
+
### fail_on_putting_template_retry_exceed
|
458
|
+
|
459
|
+
Indicates whether to fail when `max_retry_putting_template` is exceeded.
|
460
|
+
If you have multiple output plugin, you could use this property to do not fail on fluentd statup.
|
461
|
+
|
462
|
+
```
|
463
|
+
fail_on_putting_template_retry_exceed false # defaults to true
|
464
|
+
```
|
465
|
+
|
466
|
+
### max_retry_get_es_version
|
467
|
+
|
468
|
+
You can specify times of retry obtaining Elasticsearch version.
|
469
|
+
|
470
|
+
This is useful when Elasticsearch plugin cannot connect Elasticsearch to obtain Elasticsearch version.
|
471
|
+
Usually, booting up clustered Elasticsearch containers are much slower than launching Fluentd container.
|
472
|
+
|
473
|
+
```
|
474
|
+
max_retry_get_es_version 17 # defaults to 15
|
475
|
+
```
|
476
|
+
|
477
|
+
### request_timeout
|
478
|
+
|
479
|
+
You can specify HTTP request timeout.
|
480
|
+
|
481
|
+
This is useful when Elasticsearch cannot return response for bulk request within the default of 5 seconds.
|
482
|
+
|
483
|
+
```
|
484
|
+
request_timeout 15s # defaults to 5s
|
485
|
+
```
|
486
|
+
|
487
|
+
### reload_connections
|
488
|
+
|
489
|
+
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.
|
490
|
+
|
491
|
+
```
|
492
|
+
reload_connections false # defaults to true
|
493
|
+
```
|
494
|
+
|
495
|
+
### reload_on_failure
|
496
|
+
|
497
|
+
Indicates that the elasticsearch-transport will try to reload the nodes addresses if there is a failure while making the
|
498
|
+
request, this can be useful to quickly remove a dead node from the list of addresses.
|
499
|
+
|
500
|
+
```
|
501
|
+
reload_on_failure true # defaults to false
|
502
|
+
```
|
503
|
+
|
504
|
+
### resurrect_after
|
505
|
+
|
506
|
+
You can set in the elasticsearch-transport how often dead connections from the elasticsearch-transport's pool will be resurrected.
|
507
|
+
|
508
|
+
```
|
509
|
+
resurrect_after 5s # defaults to 60s
|
510
|
+
```
|
511
|
+
|
512
|
+
### include_tag_key, tag_key
|
513
|
+
|
514
|
+
```
|
515
|
+
include_tag_key true # defaults to false
|
516
|
+
tag_key tag # defaults to tag
|
517
|
+
```
|
518
|
+
|
519
|
+
This will add the Fluentd tag in the JSON record. For instance, if you have a config like this:
|
520
|
+
|
521
|
+
```
|
522
|
+
<match my.logs>
|
523
|
+
@type elasticsearch
|
524
|
+
include_tag_key true
|
525
|
+
tag_key _key
|
526
|
+
</match>
|
527
|
+
```
|
528
|
+
|
529
|
+
The record inserted into Elasticsearch would be
|
530
|
+
|
531
|
+
```
|
532
|
+
{"_key": "my.logs", "name": "Johnny Doeie"}
|
533
|
+
```
|
534
|
+
|
535
|
+
### id_key
|
536
|
+
|
537
|
+
```
|
538
|
+
id_key request_id # use "request_id" field as a record id in ES
|
539
|
+
```
|
540
|
+
|
541
|
+
By default, all records inserted into Elasticsearch get a random _id. This option allows to use a field in the record as an identifier.
|
542
|
+
|
543
|
+
This following record `{"name": "Johnny", "request_id": "87d89af7daffad6"}` will trigger the following Elasticsearch command
|
544
|
+
|
545
|
+
```
|
546
|
+
{ "index" : { "_index": "logstash-2013.01.01", "_type": "fluentd", "_id": "87d89af7daffad6" } }
|
547
|
+
{ "name": "Johnny", "request_id": "87d89af7daffad6" }
|
548
|
+
```
|
549
|
+
|
550
|
+
Fluentd re-emits events that failed to be indexed/ingested in Elasticsearch with a new and unique `_id` value, this means that congested Elasticsearch clusters that reject events (due to command queue overflow, for example) will cause Fluentd to re-emit the event with a new `_id`, however Elasticsearch may actually process both (or more) attempts (with some delay) and create duplicate events in the index (since each have a unique `_id` value), one possible workaround is to use the [fluent-plugin-genhashvalue](https://github.com/mtakemi/fluent-plugin-genhashvalue) plugin to generate a unique `_hash` key in the record of each event, this `_hash` record can be used as the `id_key` to prevent Elasticsearch from creating duplicate events.
|
551
|
+
|
552
|
+
```
|
553
|
+
id_key _hash
|
554
|
+
```
|
555
|
+
|
556
|
+
Example configuration for [fluent-plugin-genhashvalue](https://github.com/mtakemi/fluent-plugin-genhashvalue) (review the documentation of the plugin for more details)
|
557
|
+
```
|
558
|
+
<filter logs.**>
|
559
|
+
@type genhashvalue
|
560
|
+
keys session_id,request_id
|
561
|
+
hash_type md5 # md5/sha1/sha256/sha512
|
562
|
+
base64_enc true
|
563
|
+
base91_enc false
|
564
|
+
set_key _hash
|
565
|
+
separator _
|
566
|
+
inc_time_as_key true
|
567
|
+
inc_tag_as_key true
|
568
|
+
</filter>
|
569
|
+
```
|
570
|
+
|
571
|
+
:warning: In order to avoid hash-collisions and loosing data careful consideration is required when choosing the keys in the event record that should be used to calculate the hash
|
572
|
+
|
573
|
+
#### Using nested key
|
574
|
+
|
575
|
+
Nested key specifying syntax is also supported.
|
576
|
+
|
577
|
+
With the following configuration
|
578
|
+
|
579
|
+
```aconf
|
580
|
+
id_key $.nested.request_id
|
581
|
+
```
|
582
|
+
|
583
|
+
and the following nested record
|
584
|
+
|
585
|
+
```json
|
586
|
+
{"nested":{"name": "Johnny", "request_id": "87d89af7daffad6"}}
|
587
|
+
```
|
588
|
+
|
589
|
+
will trigger the following Elasticsearch command
|
590
|
+
|
591
|
+
```
|
592
|
+
{"index":{"_index":"fluentd","_type":"fluentd","_id":"87d89af7daffad6"}}
|
593
|
+
{"nested":{"name":"Johnny","request_id":"87d89af7daffad6"}}
|
594
|
+
```
|
595
|
+
|
596
|
+
:warning: Note that [Hash flattening](#hash-flattening) may be conflict nested record feature.
|
597
|
+
|
598
|
+
### parent_key
|
599
|
+
|
600
|
+
```
|
601
|
+
parent_key a_parent # use "a_parent" field value to set _parent in elasticsearch command
|
602
|
+
```
|
603
|
+
|
604
|
+
If your input is
|
605
|
+
```
|
606
|
+
{ "name": "Johnny", "a_parent": "my_parent" }
|
607
|
+
```
|
608
|
+
|
609
|
+
Elasticsearch command would be
|
610
|
+
|
611
|
+
```
|
612
|
+
{ "index" : { "_index": "****", "_type": "****", "_id": "****", "_parent": "my_parent" } }
|
613
|
+
{ "name": "Johnny", "a_parent": "my_parent" }
|
614
|
+
```
|
615
|
+
|
616
|
+
if `parent_key` is not configed or the `parent_key` is absent in input record, nothing will happen.
|
617
|
+
|
618
|
+
#### Using nested key
|
619
|
+
|
620
|
+
Nested key specifying syntax is also supported.
|
621
|
+
|
622
|
+
With the following configuration
|
623
|
+
|
624
|
+
```aconf
|
625
|
+
parent_key $.nested.a_parent
|
626
|
+
```
|
627
|
+
|
628
|
+
and the following nested record
|
629
|
+
|
630
|
+
```json
|
631
|
+
{"nested":{ "name": "Johnny", "a_parent": "my_parent" }}
|
632
|
+
```
|
633
|
+
|
634
|
+
will trigger the following Elasticsearch command
|
635
|
+
|
636
|
+
```
|
637
|
+
{"index":{"_index":"fluentd","_type":"fluentd","_parent":"my_parent"}}
|
638
|
+
{"nested":{"name":"Johnny","a_parent":"my_parent"}}
|
639
|
+
```
|
640
|
+
|
641
|
+
:warning: Note that [Hash flattening](#hash-flattening) may be conflict nested record feature.
|
642
|
+
|
643
|
+
### routing_key
|
644
|
+
|
645
|
+
Similar to `parent_key` config, will add `_routing` into elasticsearch command if `routing_key` is set and the field does exist in input event.
|
646
|
+
|
647
|
+
### remove_keys
|
648
|
+
|
649
|
+
```
|
650
|
+
parent_key a_parent
|
651
|
+
routing_key a_routing
|
652
|
+
remove_keys a_parent, a_routing # a_parent and a_routing fields won't be sent to elasticsearch
|
653
|
+
```
|
654
|
+
|
655
|
+
### remove_keys_on_update
|
656
|
+
|
657
|
+
Remove keys on update will not update the configured keys in elasticsearch when a record is being updated.
|
658
|
+
This setting only has any effect if the write operation is update or upsert.
|
659
|
+
|
660
|
+
If the write setting is upsert then these keys are only removed if the record is being
|
661
|
+
updated, if the record does not exist (by id) then all of the keys are indexed.
|
662
|
+
|
663
|
+
```
|
664
|
+
remove_keys_on_update foo,bar
|
665
|
+
```
|
666
|
+
|
667
|
+
### remove_keys_on_update_key
|
668
|
+
|
669
|
+
This setting allows `remove_keys_on_update` to be configured with a key in each record, in much the same way as `target_index_key` works.
|
670
|
+
The configured key is removed before indexing in elasticsearch. If both `remove_keys_on_update` and `remove_keys_on_update_key` is
|
671
|
+
present in the record then the keys in record are used, if the `remove_keys_on_update_key` is not present then the value of
|
672
|
+
`remove_keys_on_update` is used as a fallback.
|
673
|
+
|
674
|
+
```
|
675
|
+
remove_keys_on_update_key keys_to_skip
|
676
|
+
```
|
677
|
+
|
678
|
+
### retry_tag
|
679
|
+
|
680
|
+
This setting allows custom routing of messages in response to bulk request failures. The default behavior is to emit
|
681
|
+
failed records using the same tag that was provided. When set to a value other then `nil`, failed messages are emitted
|
682
|
+
with the specified tag:
|
683
|
+
|
684
|
+
```
|
685
|
+
retry_tag 'retry_es'
|
686
|
+
```
|
687
|
+
**NOTE:** `retry_tag` is optional. If you would rather use labels to reroute retries, add a label (e.g '@label @SOMELABEL') to your fluent
|
688
|
+
elasticsearch plugin configuration. Retry records are, by default, submitted for retry to the ROOT label, which means
|
689
|
+
records will flow through your fluentd pipeline from the beginning. This may nor may not be a problem if the pipeline
|
690
|
+
is idempotent - that is - you can process a record again with no changes. Use tagging or labeling to ensure your retry
|
691
|
+
records are not processed again by your fluentd processing pipeline.
|
692
|
+
|
693
|
+
### write_operation
|
694
|
+
|
695
|
+
The write_operation can be any of:
|
696
|
+
|
697
|
+
| Operation | Description |
|
698
|
+
| ------------- | ----------- |
|
699
|
+
| index (default) | new data is added while existing data (based on its id) is replaced (reindexed).|
|
700
|
+
| create | adds new data - if the data already exists (based on its id), the op is skipped.|
|
701
|
+
| update | updates existing data (based on its id). If no data is found, the op is skipped.|
|
702
|
+
| upsert | known as merge or insert if the data does not exist, updates if the data exists (based on its id).|
|
703
|
+
|
704
|
+
**Please note, id is required in create, update, and upsert scenario. Without id, the message will be dropped.**
|
705
|
+
|
706
|
+
### time_parse_error_tag
|
707
|
+
|
708
|
+
With `logstash_format true`, elasticsearch plugin parses timestamp field for generating index name. If the record has invalid timestamp value, this plugin emits an error event to `@ERROR` label with `time_parse_error_tag` configured tag.
|
709
|
+
|
710
|
+
Default value is `Fluent::ElasticsearchOutput::TimeParser.error` for backward compatibility. `::` separated tag is not good for tag routing because some plugins assume tag is separated by `.`. We recommend to set this parameter like `time_parse_error_tag es_plugin.output.time.error`.
|
711
|
+
We will change default value to `.` separated tag.
|
712
|
+
|
713
|
+
### reconnect_on_error
|
714
|
+
Indicates that the plugin should reset connection on any error (reconnect on next send).
|
715
|
+
By default it will reconnect only on "host unreachable exceptions".
|
716
|
+
We recommended to set this true in the presence of elasticsearch shield.
|
717
|
+
```
|
718
|
+
reconnect_on_error true # defaults to false
|
719
|
+
```
|
720
|
+
|
721
|
+
### with_transporter_log
|
722
|
+
|
723
|
+
This is debugging purpose option to enable to obtain transporter layer log.
|
724
|
+
Default value is `false` for backward compatibility.
|
725
|
+
|
726
|
+
We recommend to set this true if you start to debug this plugin.
|
727
|
+
|
728
|
+
```
|
729
|
+
with_transporter_log true
|
730
|
+
```
|
731
|
+
|
732
|
+
### content_type
|
733
|
+
|
734
|
+
With `content_type application/x-ndjson`, elasticsearch plugin adds `application/x-ndjson` as `Content-Type` in payload.
|
735
|
+
|
736
|
+
Default value is `application/json` which is default Content-Type of Elasticsearch requests.
|
737
|
+
If you will not use template, it recommends to set `content_type application/x-ndjson`.
|
738
|
+
|
739
|
+
```
|
740
|
+
content_type application/x-ndjson
|
741
|
+
```
|
742
|
+
|
743
|
+
### include_index_in_url
|
744
|
+
|
745
|
+
With this option set to true, Fluentd manifests the index name in the request URL (rather than in the request body).
|
746
|
+
You can use this option to enforce an URL-based access control.
|
747
|
+
|
748
|
+
```
|
749
|
+
include_index_in_url true
|
750
|
+
```
|
751
|
+
|
752
|
+
### http_backend
|
753
|
+
|
754
|
+
With `http_backend typhoeus`, elasticsearch plugin uses typhoeus faraday http backend.
|
755
|
+
Typhoeus can handle HTTP keepalive.
|
756
|
+
|
757
|
+
Default value is `excon` which is default http_backend of elasticsearch plugin.
|
758
|
+
|
759
|
+
```
|
760
|
+
http_backend typhoeus
|
761
|
+
```
|
762
|
+
|
763
|
+
### prefer_oj_serializer
|
764
|
+
|
765
|
+
With default behavior, Elasticsearch client uses `Yajl` as JSON encoder/decoder.
|
766
|
+
`Oj` is the alternative high performance JSON encoder/decoder.
|
767
|
+
When this parameter sets as `true`, Elasticsearch client uses `Oj` as JSON encoder/decoder.
|
768
|
+
|
769
|
+
Default value is `false`.
|
770
|
+
|
771
|
+
```
|
772
|
+
prefer_oj_serializer true
|
773
|
+
```
|
774
|
+
|
775
|
+
### Client/host certificate options
|
776
|
+
|
777
|
+
Need to verify Elasticsearch's certificate? You can use the following parameter to specify a CA instead of using an environment variable.
|
778
|
+
```
|
779
|
+
ca_file /path/to/your/ca/cert
|
780
|
+
```
|
781
|
+
|
782
|
+
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.
|
783
|
+
```
|
784
|
+
client_cert /path/to/your/client/cert
|
785
|
+
client_key /path/to/your/private/key
|
786
|
+
client_key_pass password
|
787
|
+
```
|
788
|
+
|
789
|
+
If you want to configure SSL/TLS version, you can specify ssl\_version parameter.
|
790
|
+
```
|
791
|
+
ssl_version TLSv1_2 # or [SSLv23, TLSv1, TLSv1_1]
|
792
|
+
```
|
793
|
+
|
794
|
+
:warning: If SSL/TLS enabled, it might have to be required to set ssl\_version.
|
795
|
+
|
796
|
+
### Proxy Support
|
797
|
+
|
798
|
+
Starting with version 0.8.0, this gem uses excon, which supports proxy with environment variables - https://github.com/excon/excon#proxy-support
|
799
|
+
|
800
|
+
### Buffer options
|
801
|
+
|
802
|
+
`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:
|
803
|
+
|
804
|
+
```
|
805
|
+
buffer_type memory
|
806
|
+
flush_interval 60s
|
807
|
+
retry_limit 17
|
808
|
+
retry_wait 1.0
|
809
|
+
num_threads 1
|
810
|
+
```
|
811
|
+
|
812
|
+
The value for option `buffer_chunk_limit` should not exceed value `http.max_content_length` in your Elasticsearch setup (by default it is 100mb).
|
813
|
+
|
814
|
+
**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)
|
815
|
+
|
816
|
+
**Note**: If you use `disable_retry_limit` in v0.12 or `retry_forever` in v0.14 or later, please be careful to consume memory inexhaustibly.
|
817
|
+
|
818
|
+
### Hash flattening
|
819
|
+
|
820
|
+
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:
|
821
|
+
|
822
|
+
{"people" => 100}
|
823
|
+
{"people" => {"some" => "thing"}}
|
824
|
+
|
825
|
+
The second log line will be rejected by the Elasticsearch parser because objects and concrete values can't live in the same field. To combat this, you can enable hash flattening.
|
826
|
+
|
827
|
+
```
|
828
|
+
flatten_hashes true
|
829
|
+
flatten_hashes_separator _
|
830
|
+
```
|
831
|
+
|
832
|
+
This will produce elasticsearch output that looks like this:
|
833
|
+
{"people_some" => "thing"}
|
834
|
+
|
835
|
+
Note that the flattener does not deal with arrays at this time.
|
836
|
+
|
837
|
+
### Generate Hash ID
|
838
|
+
|
839
|
+
By default, the fluentd elasticsearch plugin does not emit records with a _id field, leaving it to Elasticsearch to generate a unique _id as the record is indexed. When an Elasticsearch cluster is congested and begins to take longer to respond than the configured request_timeout, the fluentd elasticsearch plugin will re-send the same bulk request. Since Elasticsearch can't tell its actually the same request, all documents in the request are indexed again resulting in duplicate data. In certain scenarios, this can result in essentially and infinite loop generating multiple copies of the same data.
|
840
|
+
|
841
|
+
The bundled elasticsearch_genid filter can generate a unique _hash key for each record, this key may be passed to the id_key parameter in the elasticsearch plugin to communicate to Elasticsearch the uniqueness of the requests so that duplicates will be rejected or simply replace the existing records.
|
842
|
+
Here is a sample config:
|
843
|
+
|
844
|
+
```
|
845
|
+
<filter **>
|
846
|
+
@type elasticsearch_genid
|
847
|
+
hash_id_key _hash # storing generated hash id key (default is _hash)
|
848
|
+
</filter>
|
849
|
+
<match **>
|
850
|
+
@type elasticsearch
|
851
|
+
id_key _hash # specify same key name which is specified in hash_id_key
|
852
|
+
remove_keys _hash # Elasticsearch doesn't like keys that start with _
|
853
|
+
# other settings are omitted.
|
854
|
+
</match>
|
855
|
+
```
|
856
|
+
|
857
|
+
### Sniffer Class Name
|
858
|
+
|
859
|
+
The default Sniffer used by the `Elasticsearch::Transport` class works well when Fluentd has a direct connection
|
860
|
+
to all of the Elasticsearch servers and can make effective use of the `_nodes` API. This doesn't work well
|
861
|
+
when Fluentd must connect through a load balancer or proxy. The parameter `sniffer_class_name` gives you the
|
862
|
+
ability to provide your own Sniffer class to implement whatever connection reload logic you require. In addition,
|
863
|
+
there is a new `Fluent::Plugin::ElasticsearchSimpleSniffer` class which reuses the hosts given in the configuration, which
|
864
|
+
is typically the hostname of the load balancer or proxy. For example, a configuration like this would cause
|
865
|
+
connections to `logging-es` to reload every 100 operations:
|
866
|
+
|
867
|
+
```
|
868
|
+
host logging-es
|
869
|
+
port 9200
|
870
|
+
reload_connections true
|
871
|
+
sniffer_class_name Fluent::Plugin::ElasticsearchSimpleSniffer
|
872
|
+
reload_after 100
|
873
|
+
```
|
874
|
+
|
875
|
+
### Reload After
|
876
|
+
|
877
|
+
When `reload_connections true`, this is the integer number of operations after which the plugin will
|
878
|
+
reload the connections. The default value is 10000.
|
879
|
+
|
880
|
+
### Validate Client Version
|
881
|
+
|
882
|
+
When you use mismatched Elasticsearch server and client libraries, fluent-plugin-elasticsearch cannot send data into Elasticsearch. The default value is `false`.
|
883
|
+
|
884
|
+
```
|
885
|
+
validate_client_version true
|
886
|
+
```
|
887
|
+
|
888
|
+
### Unrecoverable Error Types
|
889
|
+
|
890
|
+
Default `unrecoverable_error_types` parameter is set up strictly.
|
891
|
+
Because `es_rejected_execution_exception` is caused by exceeding Elasticsearch's thread pool capacity.
|
892
|
+
Advanced users can increase its capacity, but normal users should follow default behavior.
|
893
|
+
|
894
|
+
If you want to increase it and forcibly retrying bulk request, please consider to change `unrecoverable_error_types` parameter from default value.
|
895
|
+
|
896
|
+
Change default value of `thread_pool.bulk.queue_size` in elasticsearch.yml:
|
897
|
+
e.g.)
|
898
|
+
|
899
|
+
```yaml
|
900
|
+
thread_pool.bulk.queue_size: 1000
|
901
|
+
```
|
902
|
+
|
903
|
+
Then, remove `es_rejected_execution_exception` from `unrecoverable_error_types` parameter:
|
904
|
+
|
905
|
+
```
|
906
|
+
unrecoverable_error_types ["out_of_memory_error"]
|
907
|
+
```
|
908
|
+
|
909
|
+
### verify_es_version_at_startup
|
910
|
+
|
911
|
+
Because Elasticsearch plugin should change behavior each of Elasticsearch major versions.
|
912
|
+
|
913
|
+
For example, Elasticsearch 6 starts to prohibit multiple type_names in one index, and Elasticsearch 7 will handle only `_doc` type_name in index.
|
914
|
+
|
915
|
+
If you want to disable to verify Elasticsearch version at start up, set it as `false`.
|
916
|
+
|
917
|
+
When using the following configuration, ES plugin intends to communicate into Elasticsearch 6.
|
918
|
+
|
919
|
+
```
|
920
|
+
verify_es_version_at_startup false
|
921
|
+
default_elasticsearch_version 6
|
922
|
+
```
|
923
|
+
|
924
|
+
The default value is `true`.
|
925
|
+
|
926
|
+
### default_elasticsearch_version
|
927
|
+
|
928
|
+
This parameter changes that ES plugin assumes default Elasticsearch version. The default value is `5`.
|
929
|
+
|
930
|
+
### custom_headers
|
931
|
+
|
932
|
+
This parameter adds additional headers to request. The default value is `{}`.
|
933
|
+
|
934
|
+
```
|
935
|
+
custom_headers {"token":"secret"}
|
936
|
+
```
|
937
|
+
|
938
|
+
### Not seeing a config you need?
|
939
|
+
|
940
|
+
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.
|
941
|
+
|
942
|
+
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:
|
943
|
+
|
944
|
+
```
|
945
|
+
<match my.logs.*>
|
946
|
+
@type forest
|
947
|
+
subtype elasticsearch
|
948
|
+
remove_prefix my.logs
|
949
|
+
<template>
|
950
|
+
logstash_prefix ${tag}
|
951
|
+
# ...
|
952
|
+
</template>
|
953
|
+
</match>
|
954
|
+
```
|
955
|
+
|
956
|
+
And yet another option is described in Dynamic Configuration section.
|
957
|
+
|
958
|
+
**Note**: If you use or evaluate Fluentd v0.14, you can use builtin placeholders. In more detail, please refer to [Placeholders](#placeholders) section.
|
959
|
+
|
960
|
+
### Dynamic configuration
|
961
|
+
|
962
|
+
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:
|
963
|
+
|
964
|
+
```
|
965
|
+
<match my.logs.*>
|
966
|
+
@type elasticsearch_dynamic
|
967
|
+
hosts ${record['host1']}:9200,${record['host2']}:9200
|
968
|
+
index_name my_index.${Time.at(time).getutc.strftime(@logstash_dateformat)}
|
969
|
+
logstash_prefix ${tag_parts[3]}
|
970
|
+
port ${9200+rand(4)}
|
971
|
+
index_name ${tag_parts[2]}-${Time.at(time).getutc.strftime(@logstash_dateformat)}
|
972
|
+
</match>
|
973
|
+
```
|
974
|
+
|
975
|
+
**Please note, this uses Ruby's `eval` for every message, so there are performance and security implications.**
|
976
|
+
|
977
|
+
### Placeholders
|
978
|
+
|
979
|
+
v0.14 placeholders can handle `${tag}` for tag, `%Y%m%d` like strftime format, and custom record keys like as `record["mykey"]`.
|
980
|
+
|
981
|
+
Note that custom chunk key is different notations for `record_reformer` and `record_modifier`.
|
982
|
+
They uses `record["some_key"]` to specify placeholders, but this feature uses `${key1}`, `${key2}` notation. And tag, time, and some arbitrary keys must be included in buffer directive attributes.
|
983
|
+
|
984
|
+
They are used as below:
|
985
|
+
|
986
|
+
#### tag
|
987
|
+
|
988
|
+
```aconf
|
989
|
+
<match my.logs>
|
990
|
+
@type elasticsearch
|
991
|
+
index_name elastic.${tag} #=> replaced with each event's tag. e.g.) elastic.test.tag
|
992
|
+
<buffer tag>
|
993
|
+
@type memory
|
994
|
+
</buffer>
|
995
|
+
# <snip>
|
996
|
+
</match>
|
997
|
+
```
|
998
|
+
|
999
|
+
#### time
|
1000
|
+
|
1001
|
+
```aconf
|
1002
|
+
<match my.logs>
|
1003
|
+
@type elasticsearch
|
1004
|
+
index_name elastic.%Y%m%d #=> e.g.) elastic.20170811
|
1005
|
+
<buffer tag, time>
|
1006
|
+
@type memory
|
1007
|
+
timekey 3600
|
1008
|
+
</buffer>
|
1009
|
+
# <snip>
|
1010
|
+
</match>
|
1011
|
+
```
|
1012
|
+
|
1013
|
+
#### custom key
|
1014
|
+
|
1015
|
+
```log
|
1016
|
+
records = {key1: "value1", key2: "value2"}
|
1017
|
+
```
|
1018
|
+
|
1019
|
+
```aconf
|
1020
|
+
<match my.logs>
|
1021
|
+
@type elasticsearch
|
1022
|
+
index_name elastic.${key1}.${key2} # => e.g.) elastic.value1.value2
|
1023
|
+
<buffer tag, key1, key2>
|
1024
|
+
@type memory
|
1025
|
+
</buffer>
|
1026
|
+
# <snip>
|
1027
|
+
</match>
|
1028
|
+
```
|
1029
|
+
|
1030
|
+
## Multi workers
|
1031
|
+
|
1032
|
+
Since Fluentd v0.14, multi workers feature had been implemented to increase throughput with multiple processes. This feature allows Fluentd processes to use one or more CPUs. This feature will be enabled by the following system configuration:
|
1033
|
+
|
1034
|
+
```
|
1035
|
+
<system>
|
1036
|
+
workers N # where N is a natural number (N >= 1).
|
1037
|
+
</system>
|
1038
|
+
```
|
1039
|
+
|
1040
|
+
## log_es_400_reason
|
1041
|
+
|
1042
|
+
By default, the error logger won't record the reason for a 400 error from the Elasticsearch API unless you set log_level to debug. However, this results in a lot of log spam, which isn't desirable if all you want is the 400 error reasons. You can set this `true` to capture the 400 error reasons without all the other debug logs.
|
1043
|
+
|
1044
|
+
Default value is `false`.
|
1045
|
+
|
1046
|
+
## suppress_doc_wrap
|
1047
|
+
|
1048
|
+
By default, record body is wrapped by 'doc'. This behavior can not handle update script requests. You can set this to suppress doc wrapping and allow record body to be untouched.
|
1049
|
+
|
1050
|
+
Default value is `false`.
|
1051
|
+
|
1052
|
+
## ignore_exceptions
|
1053
|
+
|
1054
|
+
A list of exception that will be ignored - when the exception occurs the chunk will be discarded and the buffer retry mechanism won't be called. It is possible also to specify classes at higher level in the hierarchy. For example
|
1055
|
+
|
1056
|
+
```
|
1057
|
+
ignore_exceptions ["Elasticsearch::Transport::Transport::ServerError"]
|
1058
|
+
```
|
1059
|
+
|
1060
|
+
will match all subclasses of `ServerError` - `Elasticsearch::Transport::Transport::Errors::BadRequest`, `Elasticsearch::Transport::Transport::Errors::ServiceUnavailable`, etc.
|
1061
|
+
|
1062
|
+
Default value is empty list (no exception is ignored).
|
1063
|
+
|
1064
|
+
## exception_backup
|
1065
|
+
|
1066
|
+
Indicates whether to backup chunk when ignore exception occurs.
|
1067
|
+
|
1068
|
+
Default value is `true`.
|
1069
|
+
|
1070
|
+
## bulk_message_request_threshold
|
1071
|
+
|
1072
|
+
Configure `bulk_message` request splitting threshold size.
|
1073
|
+
|
1074
|
+
Default value is `20MB`. (20 * 1024 * 1024)
|
1075
|
+
|
1076
|
+
If you specify this size as negative number, `bulk_message` request splitting feature will be disabled.
|
1077
|
+
|
1078
|
+
## Troubleshooting
|
1079
|
+
|
1080
|
+
### Cannot send events to Elasticsearch
|
1081
|
+
|
1082
|
+
A common cause of failure is that you are trying to connect to an Elasticsearch instance with an incompatible version.
|
1083
|
+
|
1084
|
+
For example, td-agent currently bundles the 6.x series of the [elasticsearch-ruby](https://github.com/elastic/elasticsearch-ruby) library. This means that your Elasticsearch server also needs to be 6.x. You can check the actual version of the client library installed on your system by executing the following command.
|
1085
|
+
|
1086
|
+
```
|
1087
|
+
# For td-agent users
|
1088
|
+
$ /usr/sbin/td-agent-gem list elasticsearch
|
1089
|
+
# For standalone Fluentd users
|
1090
|
+
$ fluent-gem list elasticsearch
|
1091
|
+
```
|
1092
|
+
Or, fluent-plugin-elasticsearch v2.11.7 or later, users can inspect version incompatibility with the `validate_client_version` option:
|
1093
|
+
|
1094
|
+
```
|
1095
|
+
validate_client_version true
|
1096
|
+
```
|
1097
|
+
|
1098
|
+
If you get the following error message, please consider to install compatible elasticsearch client gems:
|
1099
|
+
|
1100
|
+
```
|
1101
|
+
Detected ES 5 but you use ES client 6.1.0.
|
1102
|
+
Please consider to use 5.x series ES client.
|
1103
|
+
```
|
1104
|
+
|
1105
|
+
For further details of the version compatibility issue, please read [the official manual](https://github.com/elastic/elasticsearch-ruby#compatibility).
|
1106
|
+
|
1107
|
+
### Cannot see detailed failure log
|
1108
|
+
|
1109
|
+
A common cause of failure is that you are trying to connect to an Elasticsearch instance with an incompatible ssl protocol version.
|
1110
|
+
|
1111
|
+
For example, `out_elasticsearch` set up ssl_version to TLSv1 due to historical reason.
|
1112
|
+
Modern Elasticsearch ecosystem requests to communicate with TLS v1.2 or later.
|
1113
|
+
But, in this case, `out_elasticsearch` conceals transporter part failure log by default.
|
1114
|
+
If you want to acquire transporter log, please consider to set the following configuration:
|
1115
|
+
|
1116
|
+
```
|
1117
|
+
with_transporter_log true
|
1118
|
+
@log_level debug
|
1119
|
+
```
|
1120
|
+
|
1121
|
+
Then, the following log is shown in Fluentd log:
|
1122
|
+
|
1123
|
+
```
|
1124
|
+
2018-10-24 10:00:00 +0900 [error]: #0 [Faraday::ConnectionFailed] SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol (OpenSSL::SSL::SSLError) {:host=>"elasticsearch-host", :port=>80, :scheme=>"https", :user=>"elastic", :password=>"changeme", :protocol=>"https"}
|
1125
|
+
```
|
1126
|
+
|
1127
|
+
This indicates that inappropriate TLS protocol version is used.
|
1128
|
+
If you want to use TLS v1.2, please use `ssl_version` parameter like as:
|
1129
|
+
|
1130
|
+
```
|
1131
|
+
ssl_version TLSv1_2
|
1132
|
+
```
|
1133
|
+
|
1134
|
+
### Cannot connect TLS enabled reverse Proxy
|
1135
|
+
|
1136
|
+
A common cause of failure is that you are trying to connect to an Elasticsearch instance behind nginx reverse proxy which uses an incompatible ssl protocol version.
|
1137
|
+
|
1138
|
+
For example, `out_elasticsearch` set up ssl_version to TLSv1 due to historical reason.
|
1139
|
+
Nowadays, nginx reverse proxy uses TLS v1.2 or later for security reason.
|
1140
|
+
But, in this case, `out_elasticsearch` conceals transporter part failure log by default.
|
1141
|
+
|
1142
|
+
If you set up nginx reverse proxy with TLS v1.2:
|
1143
|
+
|
1144
|
+
```
|
1145
|
+
server {
|
1146
|
+
listen <your IP address>:9400;
|
1147
|
+
server_name <ES-Host>;
|
1148
|
+
ssl on;
|
1149
|
+
ssl_certificate /etc/ssl/certs/server-bundle.pem;
|
1150
|
+
ssl_certificate_key /etc/ssl/private/server-key.pem;
|
1151
|
+
ssl_client_certificate /etc/ssl/certs/ca.pem;
|
1152
|
+
ssl_verify_client on;
|
1153
|
+
ssl_verify_depth 2;
|
1154
|
+
|
1155
|
+
# Reference : https://cipherli.st/
|
1156
|
+
ssl_protocols TLSv1.2;
|
1157
|
+
ssl_prefer_server_ciphers on;
|
1158
|
+
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
|
1159
|
+
ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
|
1160
|
+
ssl_session_cache shared:SSL:10m;
|
1161
|
+
ssl_session_tickets off; # Requires nginx >= 1.5.9
|
1162
|
+
ssl_stapling on; # Requires nginx >= 1.3.7
|
1163
|
+
ssl_stapling_verify on; # Requires nginx => 1.3.7
|
1164
|
+
resolver 127.0.0.1 valid=300s;
|
1165
|
+
resolver_timeout 5s;
|
1166
|
+
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
|
1167
|
+
add_header X-Frame-Options DENY;
|
1168
|
+
add_header X-Content-Type-Options nosniff;
|
1169
|
+
|
1170
|
+
client_max_body_size 64M;
|
1171
|
+
keepalive_timeout 5;
|
1172
|
+
|
1173
|
+
location / {
|
1174
|
+
proxy_set_header Host $host;
|
1175
|
+
proxy_set_header X-Real-IP $remote_addr;
|
1176
|
+
proxy_pass http://localhost:9200;
|
1177
|
+
}
|
1178
|
+
}
|
1179
|
+
```
|
1180
|
+
|
1181
|
+
Then, nginx reverse proxy starts with TLSv1.2.
|
1182
|
+
|
1183
|
+
Fluentd suddenly dies with the following log:
|
1184
|
+
```
|
1185
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: log writing failed. execution expired
|
1186
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/ssl_socket.rb:10:in `initialize': stack level too deep (SystemStackError)
|
1187
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/connection.rb:429:in `new'
|
1188
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/connection.rb:429:in `socket'
|
1189
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/connection.rb:111:in `request_call'
|
1190
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/mock.rb:48:in `request_call'
|
1191
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/instrumentor.rb:26:in `request_call'
|
1192
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/base.rb:16:in `request_call'
|
1193
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/base.rb:16:in `request_call'
|
1194
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/base.rb:16:in `request_call'
|
1195
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: ... 9266 levels...
|
1196
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/td-agent/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
|
1197
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.2.5/bin/fluentd:8:in `<top (required)>'
|
1198
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/bin/fluentd:22:in `load'
|
1199
|
+
Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/bin/fluentd:22:in `<main>'
|
1200
|
+
Oct 31 9:44:45 <ES-Host> systemd[1]: fluentd.service: Control process exited, code=exited status=1
|
1201
|
+
```
|
1202
|
+
|
1203
|
+
If you want to acquire transporter log, please consider to set the following configuration:
|
1204
|
+
|
1205
|
+
```
|
1206
|
+
with_transporter_log true
|
1207
|
+
@log_level debug
|
1208
|
+
```
|
1209
|
+
|
1210
|
+
Then, the following log is shown in Fluentd log:
|
1211
|
+
|
1212
|
+
```
|
1213
|
+
2018-10-31 10:00:57 +0900 [warn]: #7 [Faraday::ConnectionFailed] Attempt 2 connecting to {:host=>"<ES-Host>", :port=>9400, :scheme=>"https", :protocol=>"https"}
|
1214
|
+
2018-10-31 10:00:57 +0900 [error]: #7 [Faraday::ConnectionFailed] Connection reset by peer - SSL_connect (Errno::ECONNRESET) {:host=>"<ES-Host>", :port=>9400, :scheme=>"https", :protocol=>"https"}
|
1215
|
+
```
|
1216
|
+
|
1217
|
+
The above logs indicates that using incompatible SSL/TLS version between fluent-plugin-elasticsearch and nginx, which is reverse proxy, is root cause of this issue.
|
1218
|
+
|
1219
|
+
If you want to use TLS v1.2, please use `ssl_version` parameter like as:
|
1220
|
+
|
1221
|
+
```
|
1222
|
+
ssl_version TLSv1_2
|
1223
|
+
```
|
1224
|
+
|
1225
|
+
### Declined logs are resubmitted forever, why?
|
1226
|
+
|
1227
|
+
Sometimes users write Fluentd configuration like this:
|
1228
|
+
|
1229
|
+
```aconf
|
1230
|
+
<match **>
|
1231
|
+
@type elasticsearch
|
1232
|
+
host localhost
|
1233
|
+
port 9200
|
1234
|
+
type_name fluentd
|
1235
|
+
logstash_format true
|
1236
|
+
time_key @timestamp
|
1237
|
+
include_timestamp true
|
1238
|
+
reconnect_on_error true
|
1239
|
+
reload_on_failure true
|
1240
|
+
reload_connections false
|
1241
|
+
request_timeout 120s
|
1242
|
+
</match>
|
1243
|
+
```
|
1244
|
+
|
1245
|
+
The above configuration does not use [`@label` feature](https://docs.fluentd.org/v1.0/articles/config-file#(5)-group-filter-and-output:-the-%E2%80%9Clabel%E2%80%9D-directive) and use glob(**) pattern.
|
1246
|
+
It is usually problematic configuration.
|
1247
|
+
|
1248
|
+
In error scenario, error events will be emitted with `@ERROR` label, and `fluent.*` tag.
|
1249
|
+
The black hole glob pattern resubmits a problematic event into pushing Elasticsearch pipeline.
|
1250
|
+
|
1251
|
+
This situation causes flood of declined log:
|
1252
|
+
|
1253
|
+
```log
|
1254
|
+
2018-11-13 11:16:27 +0000 [warn]: #0 dump an error event: error_class=Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchError error="400 - Rejected by Elasticsearch" location=nil tag="app.fluentcat" time=2018-11-13 11:16:17.492985640 +0000 record={"message"=>"\xFF\xAD"}
|
1255
|
+
2018-11-13 11:16:38 +0000 [warn]: #0 dump an error event: error_class=Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchError error="400 - Rejected by Elasticsearch" location=nil tag="fluent.warn" time=2018-11-13 11:16:27.978851140 +0000 record={"error"=>"#<Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchError: 400 - Rejected by Elasticsearch>", "location"=>nil, "tag"=>"app.fluentcat", "time"=>2018-11-13 11:16:17.492985640 +0000, "record"=>{"message"=>"\xFF\xAD"}, "message"=>"dump an error event: error_class=Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchError error=\"400 - Rejected by Elasticsearch\" location=nil tag=\"app.fluentcat\" time=2018-11-13 11:16:17.492985640 +0000 record={\"message\"=>\"\\xFF\\xAD\"}"}
|
1256
|
+
```
|
1257
|
+
|
1258
|
+
Then, user should use more concrete tag route or use `@label`.
|
1259
|
+
The following sections show two examples how to solve flood of declined log.
|
1260
|
+
One is using concrete tag routing, the other is using label routing.
|
1261
|
+
|
1262
|
+
#### Using concrete tag routing
|
1263
|
+
|
1264
|
+
The following configuration uses concrete tag route:
|
1265
|
+
|
1266
|
+
```aconf
|
1267
|
+
<match out.elasticsearch.**>
|
1268
|
+
@type elasticsearch
|
1269
|
+
host localhost
|
1270
|
+
port 9200
|
1271
|
+
type_name fluentd
|
1272
|
+
logstash_format true
|
1273
|
+
time_key @timestamp
|
1274
|
+
include_timestamp true
|
1275
|
+
reconnect_on_error true
|
1276
|
+
reload_on_failure true
|
1277
|
+
reload_connections false
|
1278
|
+
request_timeout 120s
|
1279
|
+
</match>
|
1280
|
+
```
|
1281
|
+
|
1282
|
+
#### Using label feature
|
1283
|
+
|
1284
|
+
The following configuration uses label:
|
1285
|
+
|
1286
|
+
```aconf
|
1287
|
+
<source>
|
1288
|
+
@type forward
|
1289
|
+
@label @ES
|
1290
|
+
</source>
|
1291
|
+
<label @ES>
|
1292
|
+
<match out.elasticsearch.**>
|
1293
|
+
@type elasticsearch
|
1294
|
+
host localhost
|
1295
|
+
port 9200
|
1296
|
+
type_name fluentd
|
1297
|
+
logstash_format true
|
1298
|
+
time_key @timestamp
|
1299
|
+
include_timestamp true
|
1300
|
+
reconnect_on_error true
|
1301
|
+
reload_on_failure true
|
1302
|
+
reload_connections false
|
1303
|
+
request_timeout 120s
|
1304
|
+
</match>
|
1305
|
+
</label>
|
1306
|
+
<label @ERROR>
|
1307
|
+
<match **>
|
1308
|
+
@type stdout
|
1309
|
+
</match>
|
1310
|
+
</label>
|
1311
|
+
```
|
1312
|
+
|
1313
|
+
### Suggested to increase flush_thread_count, why?
|
1314
|
+
|
1315
|
+
fluent-plugin-elasticsearch default behavior has a possibility to cause events traffic jam.
|
1316
|
+
When users use `flush_thread_count` = 1, ES plugin retries to send events if connection errors are disappeared.
|
1317
|
+
|
1318
|
+
To prevent the following warning and sending events blocking, you must specify `flush_thread_count` >= 2:
|
1319
|
+
|
1320
|
+
```log
|
1321
|
+
2018-12-24 14:32:06 +0900 [warn]: #0 To prevent events traffic jam, you should specify 2 or more 'flush_thread_count'.
|
1322
|
+
```
|
1323
|
+
|
1324
|
+
```aconf
|
1325
|
+
<match out.elasticsearch.**>
|
1326
|
+
@type elasticsearch
|
1327
|
+
host localhost
|
1328
|
+
port 9200
|
1329
|
+
# ...
|
1330
|
+
<buffer tag>
|
1331
|
+
@type memory # or file
|
1332
|
+
flush_thread_count 4
|
1333
|
+
</buffer>
|
1334
|
+
</match>
|
1335
|
+
```
|
1336
|
+
|
1337
|
+
### Suggested to install typhoeus gem, why?
|
1338
|
+
|
1339
|
+
fluent-plugin-elasticsearch doesn't depend on typhoeus gem by default.
|
1340
|
+
If you want to use typhoeus backend, you must install typhoeus gem by your own.
|
1341
|
+
|
1342
|
+
If you use vanilla Fluentd, you can install it by:
|
1343
|
+
|
1344
|
+
```
|
1345
|
+
gem install typhoeus
|
1346
|
+
```
|
1347
|
+
|
1348
|
+
But, you use td-agent instead of vanilla Fluentd, you have to use `td-agent-gem`:
|
1349
|
+
|
1350
|
+
```
|
1351
|
+
td-agent-gem install typhoeus
|
1352
|
+
```
|
1353
|
+
|
1354
|
+
In more detail, please refer to [the official plugin management document](https://docs.fluentd.org/v1.0/articles/plugin-management).
|
1355
|
+
|
1356
|
+
### Stopped to send events on k8s, why?
|
1357
|
+
|
1358
|
+
fluent-plugin-elasticsearch reloads connection after 10000 requests. (Not correspond to events counts because ES plugin uses bulk API.)
|
1359
|
+
|
1360
|
+
This functionality which is originated from elasticsearch-ruby gem is enabled by default.
|
1361
|
+
|
1362
|
+
Sometimes this reloading functionality bothers users to send events with ES plugin.
|
1363
|
+
|
1364
|
+
On k8s platform, users sometimes shall specify the following settings:
|
1365
|
+
|
1366
|
+
```aconf
|
1367
|
+
reload_connections false
|
1368
|
+
reconnect_on_error true
|
1369
|
+
reload_on_failure true
|
1370
|
+
```
|
1371
|
+
|
1372
|
+
If you use [fluentd-kubernetes-daemonset](https://github.com/fluent/fluentd-kubernetes-daemonset), you can specify them with environment variables:
|
1373
|
+
|
1374
|
+
* `FLUENT_ELASTICSEARCH_RELOAD_CONNECTIONS` as `false`
|
1375
|
+
* `FLUENT_ELASTICSEARCH_RECONNECT_ON_ERROR` as `true`
|
1376
|
+
* `FLUENT_ELASTICSEARCH_RELOAD_ON_FAILURE` as `true`
|
1377
|
+
|
1378
|
+
This issue had been reported at [#525](https://github.com/uken/fluent-plugin-elasticsearch/issues/525).
|
1379
|
+
|
1380
|
+
### Random 400 - Rejected by Elasticsearch is occured, why?
|
1381
|
+
|
1382
|
+
Index templates installed Elasticsearch sometimes generates 400 - Rejected by Elasticsearch errors.
|
1383
|
+
For example, kubernetes audit log has structure:
|
1384
|
+
|
1385
|
+
```json
|
1386
|
+
"responseObject":{
|
1387
|
+
"kind":"SubjectAccessReview",
|
1388
|
+
"apiVersion":"authorization.k8s.io/v1beta1",
|
1389
|
+
"metadata":{
|
1390
|
+
"creationTimestamp":null
|
1391
|
+
},
|
1392
|
+
"spec":{
|
1393
|
+
"nonResourceAttributes":{
|
1394
|
+
"path":"/",
|
1395
|
+
"verb":"get"
|
1396
|
+
},
|
1397
|
+
"user":"system:anonymous",
|
1398
|
+
"group":[
|
1399
|
+
"system:unauthenticated"
|
1400
|
+
]
|
1401
|
+
},
|
1402
|
+
"status":{
|
1403
|
+
"allowed":true,
|
1404
|
+
"reason":"RBAC: allowed by ClusterRoleBinding \"cluster-system-anonymous\" of ClusterRole \"cluster-admin\" to User \"system:anonymous\""
|
1405
|
+
}
|
1406
|
+
},
|
1407
|
+
```
|
1408
|
+
|
1409
|
+
The last element `status` sometimes becomes `"status":"Success"`.
|
1410
|
+
This element type glich causes status 400 error.
|
1411
|
+
|
1412
|
+
There are some solutions for fixing this:
|
1413
|
+
|
1414
|
+
#### Solution 1
|
1415
|
+
|
1416
|
+
For a key which causes element type glich case.
|
1417
|
+
|
1418
|
+
Using dymanic mapping with the following template:
|
1419
|
+
|
1420
|
+
```json
|
1421
|
+
{
|
1422
|
+
"template": "YOURINDEXNAME-*",
|
1423
|
+
"mappings": {
|
1424
|
+
"fluentd": {
|
1425
|
+
"dynamic_templates": [
|
1426
|
+
{
|
1427
|
+
"default_no_index": {
|
1428
|
+
"path_match": "^.*$",
|
1429
|
+
"path_unmatch": "^(@timestamp|auditID|level|stage|requestURI|sourceIPs|metadata|objectRef|user|verb)(\\..+)?$",
|
1430
|
+
"match_pattern": "regex",
|
1431
|
+
"mapping": {
|
1432
|
+
"index": false,
|
1433
|
+
"enabled": false
|
1434
|
+
}
|
1435
|
+
}
|
1436
|
+
}
|
1437
|
+
]
|
1438
|
+
}
|
1439
|
+
}
|
1440
|
+
}
|
1441
|
+
```
|
1442
|
+
|
1443
|
+
Note that `YOURINDEXNAME` should be replaced with your using index prefix.
|
1444
|
+
|
1445
|
+
#### Solution 2
|
1446
|
+
|
1447
|
+
For unstable `responseObject` and `requestObject` key existence case.
|
1448
|
+
|
1449
|
+
```aconf
|
1450
|
+
<filter YOURROUTETAG>
|
1451
|
+
@id kube_api_audit_normalize
|
1452
|
+
@type record_transformer
|
1453
|
+
auto_typecast false
|
1454
|
+
enable_ruby true
|
1455
|
+
<record>
|
1456
|
+
host "#{ENV['K8S_NODE_NAME']}"
|
1457
|
+
responseObject ${record["responseObject"].nil? ? "none": record["responseObject"].to_json}
|
1458
|
+
requestObject ${record["requestObject"].nil? ? "none": record["requestObject"].to_json}
|
1459
|
+
origin kubernetes-api-audit
|
1460
|
+
</record>
|
1461
|
+
</filter>
|
1462
|
+
```
|
1463
|
+
|
1464
|
+
Normalize `responseObject` and `requestObject` key with record_transformer and other similiar plugins is needed.
|
1465
|
+
|
1466
|
+
### Fluentd seems to hang if it unable to connect Elasticsearch, why?
|
1467
|
+
|
1468
|
+
On `#configure` phase, ES plugin should wait until ES instance communication is succeeded.
|
1469
|
+
And ES plugin blocks to launch Fluentd by default.
|
1470
|
+
Because Fluentd requests to set up configuration correctly on `#configure` phase.
|
1471
|
+
|
1472
|
+
After `#configure` phase, it runs very fast and send events heavily in some heavily using case.
|
1473
|
+
|
1474
|
+
In this scenario, we need to set up configuration correctly until `#configure` phase.
|
1475
|
+
So, we provide default parameter is too conservative to use advanced users.
|
1476
|
+
|
1477
|
+
To remove too pessimistic behavior, you can use the following configuration:
|
1478
|
+
|
1479
|
+
```aconf
|
1480
|
+
<match **>
|
1481
|
+
@type elasticsearch
|
1482
|
+
# Some advanced users know their using ES version.
|
1483
|
+
# We can disable startup ES version checking.
|
1484
|
+
verify_es_version_at_startup false
|
1485
|
+
# If you know that your using ES major version is 7, you can set as 7 here.
|
1486
|
+
default_elasticsearch_version 7
|
1487
|
+
# If using very stable ES cluster, you can reduce retry operation counts. (minmum is 1)
|
1488
|
+
max_retry_get_es_version 1
|
1489
|
+
# If using very stable ES cluster, you can reduce retry operation counts. (minmum is 1)
|
1490
|
+
max_retry_putting_template 1
|
1491
|
+
# ... and some ES plugin configuration
|
1492
|
+
</match>
|
1493
|
+
```
|
1494
|
+
|
1495
|
+
## Contact
|
1496
|
+
|
1497
|
+
If you have a question, [open an Issue](https://github.com/uken/fluent-plugin-elasticsearch/issues).
|
1498
|
+
|
1499
|
+
## Contributing
|
1500
|
+
|
1501
|
+
There are usually a few feature requests, tagged [Easy](https://github.com/uken/fluent-plugin-elasticsearch/issues?q=is%3Aissue+is%3Aopen+label%3Alevel%3AEasy), [Normal](https://github.com/uken/fluent-plugin-elasticsearch/issues?q=is%3Aissue+is%3Aopen+label%3Alevel%3ANormal) and [Hard](https://github.com/uken/fluent-plugin-elasticsearch/issues?q=is%3Aissue+is%3Aopen+label%3Alevel%3AHard). Feel free to work on any one of them.
|
1502
|
+
|
1503
|
+
Pull Requests are welcomed.
|
1504
|
+
|
1505
|
+
[![Pull Request Graph](https://graphs.waffle.io/uken/fluent-plugin-elasticsearch/throughput.svg)](https://waffle.io/uken/fluent-plugin-elasticsearch/metrics)
|
1506
|
+
|
1507
|
+
## Running tests
|
1508
|
+
|
1509
|
+
Install dev dependencies:
|
1510
|
+
|
1511
|
+
```sh
|
1512
|
+
$ gem install bundler
|
1513
|
+
$ bundle install
|
1514
|
+
$ bundle exec rake test
|
1515
|
+
```
|