Skip to content

Commit

Permalink
Enable log.format.json.fix_duplicate_message_fields by default (#16578)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kaisecheng authored Oct 17, 2024
1 parent dcafa08 commit 467ab3f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/logstash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
#
Expand Down
2 changes: 1 addition & 1 deletion docs/static/running-logstash-command-line.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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` <<logstash-settings-file,settings file>> as well
Expand Down
2 changes: 1 addition & 1 deletion docs/static/settings-file.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion logstash-core/lib/logstash/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 467ab3f

Please sign in to comment.