kibana/docs/developer/architecture/core/logging-configuration-migration.asciidoc
Pierre Gayvallet a4b74bd398
[8.0] Remove legacy logging (#112305)
* remove kbn-legacy-logging package

* remove legacy service

* remove legacy appender

* remove LegacyObjectToConfigAdapter

* gix types

* remove @hapi/good / @hapi/good-squeeze / @hapi/podium

* remove `default` appender validation for `root` logger

* remove old config key from kibana-docker

* fix FTR config

* fix dev server

* remove reference from readme

* fix unit test

* clean CLI args and remove quiet option

* fix type

* fix status test config

* remove from test config

* fix snapshot

* use another regexp

* update generated doc

* fix createRootWithSettings

* fix some integration tests

* another IT fix

* yet another IT fix

* (will be reverted) add assertion for CI failure

* Revert "(will be reverted) add assertion for CI failure"

This reverts commit 78d5560f9e.

* switch back to json layout for test

* remove legacy logging config deprecations

* address some review comments

* update documentation

* update kibana.yml config examples

* add config example for `metrics.ops`

Co-authored-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-10-05 13:30:56 +02:00

80 lines
2.6 KiB
Text

[[logging-configuration-migration]]
== Logging configuration migration
Compatibility with the legacy logging system is assured until the end of the `v7` version.
All log messages handled by `root` context are forwarded to the legacy logging service. If you re-write
root appenders, make sure that it contains `default` appender to provide backward compatibility.
NOTE: When you switch to the new logging configuration, you will start seeing duplicate log entries in both formats.
These will be removed when the `default` appender is no longer required. If you define an appender for a logger,
the log messages aren't handled by the `root` logger anymore and are not forwarded to the legacy logging service.
[[logging-pattern-format-old-and-new-example]]
[options="header"]
|===
| Parameter | Platform log record in **pattern** format | Legacy Platform log record **text** format
| @timestamp | ISO8601_TZ `2012-01-31T23:33:22.011-05:00` | Absolute `23:33:22.011`
| logger | `parent.child` | `['parent', 'child']`
| level | `DEBUG` | `['debug']`
| meta | stringified JSON object `{"to": "v8"}`| N/A
| pid | can be configured as `%pid` | N/A
|===
[[logging-json-format-old-and-new-example]]
[options="header"]
|===
| Parameter | Platform log record in **json** format | Legacy Platform log record **json** format
| @timestamp | ISO8601_TZ `2012-01-31T23:33:22.011-05:00` | ISO8601 `2012-01-31T23:33:22.011Z`
| logger | `log.logger: parent.child` | `tags: ['parent', 'child']`
| level | `log.level: DEBUG` | `tags: ['debug']`
| meta | merged in log record `{... "to": "v8"}` | merged in log record `{... "to": "v8"}`
| pid | `process.pid: 12345` | `pid: 12345`
| type | N/A | `type: log`
| error | `{ message, name, stack }` | `{ message, name, stack, code, signal }`
|===
[[logging-cli-migration]]
=== Logging configuration via CLI
As is the case for any of Kibana's config settings, you can specify your logging configuration via the CLI. For convenience, the `--verbose` and `--silent` flags exist as shortcuts and will continue to be supported beyond v7.
If you wish to override these flags, you can always do so by passing your preferred logging configuration directly to the CLI. For example, with the following configuration:
[source,yaml]
----
logging:
appenders:
custom:
type: console
layout:
type: pattern
pattern: "[%date][%level] %message"
----
you can override the flags with:
[options="header"]
|===
| legacy logging | {kib} Platform logging | cli shortcuts
|--verbose| --logging.root.level=debug --logging.root.appenders[0]=default --logging.root.appenders[1]=custom | --verbose
|--silent| --logging.root.level=off | --silent
|===