From 467ab3f44b6f0c2b09f6c39b7a5f90727e761485 Mon Sep 17 00:00:00 2001 From: kaisecheng <69120390+kaisecheng@users.noreply.github.com> Date: Thu, 17 Oct 2024 16:22:30 +0100 Subject: [PATCH] Enable log.format.json.fix_duplicate_message_fields by default (#16578) Set `log.format.json.fix_duplicate_message_fields` to `true` as default to avoid collision of the message field in log lines when log.format is JSON --- config/logstash.yml | 2 +- docs/static/running-logstash-command-line.asciidoc | 2 +- docs/static/settings-file.asciidoc | 2 +- logstash-core/lib/logstash/environment.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/logstash.yml b/config/logstash.yml index 62b5912c498..59703aa54f6 100644 --- a/config/logstash.yml +++ b/config/logstash.yml @@ -314,7 +314,7 @@ # * json # # log.format: plain -# log.format.json.fix_duplicate_message_fields: false +# log.format.json.fix_duplicate_message_fields: true # # path.logs: # diff --git a/docs/static/running-logstash-command-line.asciidoc b/docs/static/running-logstash-command-line.asciidoc index 646ea60acfa..37873ff967c 100644 --- a/docs/static/running-logstash-command-line.asciidoc +++ b/docs/static/running-logstash-command-line.asciidoc @@ -231,7 +231,7 @@ With this command, Logstash concatenates three config files, `/tmp/one`, `/tmp/t (using Ruby's Object#inspect). The default is "plain". *`--log.format.json.fix_duplicate_message_fields ENABLED`*:: - Avoid `message` field collision using JSON log format. Possible values are `false` (default) and `true`. + Avoid `message` field collision using JSON log format. Possible values are `true` (default) and `false`. *`--path.settings SETTINGS_DIR`*:: Set the directory containing the `logstash.yml` <> as well diff --git a/docs/static/settings-file.asciidoc b/docs/static/settings-file.asciidoc index b30207bd62e..bc43cec6741 100644 --- a/docs/static/settings-file.asciidoc +++ b/docs/static/settings-file.asciidoc @@ -338,7 +338,7 @@ The log level. Valid options are: | `log.format.json.fix_duplicate_message_fields` | When the log format is `json` avoid collision of field names in log lines. -| `false` +| `true` | `path.logs` | The directory where Logstash will write its log to. diff --git a/logstash-core/lib/logstash/environment.rb b/logstash-core/lib/logstash/environment.rb index 59c385c3818..d8d7033f210 100644 --- a/logstash-core/lib/logstash/environment.rb +++ b/logstash-core/lib/logstash/environment.rb @@ -71,7 +71,7 @@ module Environment Setting::Boolean.new("help", false), Setting::Boolean.new("enable-local-plugin-development", false), Setting::String.new("log.format", "plain", true, ["json", "plain"]), - Setting::Boolean.new("log.format.json.fix_duplicate_message_fields", false), + Setting::Boolean.new("log.format.json.fix_duplicate_message_fields", true), Setting::Boolean.new("api.enabled", true).with_deprecated_alias("http.enabled", "9"), Setting::String.new("api.http.host", "127.0.0.1").with_deprecated_alias("http.host", "9"), Setting::PortRange.new("api.http.port", 9600..9700).with_deprecated_alias("http.port", "9"),