From e4183f0ff9c55a079b740455fe437d45e60f956c Mon Sep 17 00:00:00 2001 From: Monica Sarbu Date: Tue, 19 May 2015 16:50:40 +0300 Subject: [PATCH] Configure bulk_size (#10) The maximum bulk size is configurable (bulk_size) from the output/ section. --- outputs/elasticsearch/output.go | 5 +++-- outputs/outputs.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/outputs/elasticsearch/output.go b/outputs/elasticsearch/output.go index fc168c44fa0..e39fe5a4e73 100644 --- a/outputs/elasticsearch/output.go +++ b/outputs/elasticsearch/output.go @@ -55,8 +55,8 @@ func (out *ElasticsearchOutput) Init(config outputs.MothershipConfig, topology_e out.FlushInterval = time.Duration(*config.Flush_interval) * time.Millisecond } out.BulkMaxSize = 10000 - if config.BulkMaxSize != nil { - out.BulkMaxSize = *config.BulkMaxSize + if config.Bulk_size != nil { + out.BulkMaxSize = *config.Bulk_size } err := out.EnableTTL() @@ -72,6 +72,7 @@ func (out *ElasticsearchOutput) Init(config outputs.MothershipConfig, topology_e logp.Info("[ElasticsearchOutput] Using index pattern [%s-]YYYY.MM.DD", out.Index) logp.Info("[ElasticsearchOutput] Topology expires after %ds", out.TopologyExpire/1000) logp.Info("[ElasticsearchOutput] Flush interval %s", out.FlushInterval) + logp.Info("[ElasticsearchOutput] Bulk size %d", out.BulkMaxSize) return nil } diff --git a/outputs/outputs.go b/outputs/outputs.go index 2d8383c4a0b..cdc60d3ca01 100644 --- a/outputs/outputs.go +++ b/outputs/outputs.go @@ -25,7 +25,7 @@ type MothershipConfig struct { Number_of_files int DataType string Flush_interval *int - BulkMaxSize *int + Bulk_size *int } // Functions to be exported by a output plugin