From 79e4bb55c465e29af58283f0d22b439fc2ebffe0 Mon Sep 17 00:00:00 2001 From: Tudor Golubenco Date: Mon, 5 Dec 2016 07:29:01 +0100 Subject: [PATCH] Use kebab_case in the settings for the JSON processor (#3111) This is to align them with the rest of our configuration files. --- CHANGELOG.asciidoc | 2 ++ libbeat/processors/actions/decode_json_fields.go | 6 +++--- libbeat/processors/actions/decode_json_fields_test.go | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index e43497b63090..749a8b76fea0 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -14,6 +14,8 @@ https://github.com/elastic/beats/compare/v5.1.1...5.1[Check the HEAD diff] *Affecting all Beats* +- Renamed the following settings of the decode_json_fields processor: maxDepth to max_depth and processArray to process_array. {pull}3111[3111] + *Metricbeat* *Packetbeat* diff --git a/libbeat/processors/actions/decode_json_fields.go b/libbeat/processors/actions/decode_json_fields.go index 392c66db6c4a..7c05f56a8082 100644 --- a/libbeat/processors/actions/decode_json_fields.go +++ b/libbeat/processors/actions/decode_json_fields.go @@ -21,8 +21,8 @@ type decodeJSONFields struct { type config struct { Fields []string `config:"fields"` - MaxDepth int `config:"maxDepth" validate:"min=1"` - ProcessArray bool `config:"processArray"` + MaxDepth int `config:"max_depth" validate:"min=1"` + ProcessArray bool `config:"process_array"` } var ( @@ -38,7 +38,7 @@ func init() { processors.RegisterPlugin("decode_json_fields", configChecked(newDecodeJSONFields, requireFields("fields"), - allowedFields("fields", "maxDepth", "processArray"))) + allowedFields("fields", "max_depth", "process_array"))) } func newDecodeJSONFields(c common.Config) (processors.Processor, error) { diff --git a/libbeat/processors/actions/decode_json_fields_test.go b/libbeat/processors/actions/decode_json_fields_test.go index 70b0bdd5df6c..f60e94d37c26 100644 --- a/libbeat/processors/actions/decode_json_fields_test.go +++ b/libbeat/processors/actions/decode_json_fields_test.go @@ -89,9 +89,9 @@ func TestValidJSONDepthTwo(t *testing.T) { } testConfig, _ = common.NewConfigFrom(map[string]interface{}{ - "fields": fields, - "processArray": false, - "maxDepth": 2, + "fields": fields, + "process_array": false, + "max_depth": 2, }) actual := getActualValue(t, testConfig, input)