Browse Source

... don't copy if params are not here :<

Thibault bui Koechlin 5 years ago
parent
commit
afd831e039
1 changed files with 8 additions and 2 deletions
  1. 8 2
      pkg/outputs/ouputs.go

+ 8 - 2
pkg/outputs/ouputs.go

@@ -328,10 +328,16 @@ func NewOutput(config *OutputFactory) (*Output, error) {
 	//turn the *OutputFactory into a map[string]string for less constraint
 	//turn the *OutputFactory into a map[string]string for less constraint
 	backendConfig := map[string]string{
 	backendConfig := map[string]string{
 		"backend":         config.BackendFolder,
 		"backend":         config.BackendFolder,
-		"max_records":     config.MaxRecords,
-		"max_records_age": config.MaxRecordsAge,
 		"flush":           strconv.FormatBool(config.Flush),
 		"flush":           strconv.FormatBool(config.Flush),
 		"debug":           strconv.FormatBool(config.Debug)}
 		"debug":           strconv.FormatBool(config.Debug)}
+
+	if config.MaxRecords != "" {
+		backendConfig["max_records"] = config.MaxRecords,
+	}
+	if config.MaxRecordsAge != "" {
+		backendConfig["max_records_age"] = config.MaxRecordsAge,
+	}
+	
 	output.bManager, err = cwplugin.NewBackendPlugin(backendConfig)
 	output.bManager, err = cwplugin.NewBackendPlugin(backendConfig)
 	if err != nil {
 	if err != nil {
 		return nil, errors.Wrap(err, "failed to load backend plugin")
 		return nil, errors.Wrap(err, "failed to load backend plugin")