Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core.logging] Deprecates legacy logging dest, json, verbosity and rotate configurations #94238

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions docs/migration/migrate_8_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,156 @@ logging:
-------------------
See https://github.com/elastic/kibana/pull/87939 for more details.

[float]
==== Logging destination is specified by the appender
*Details:* Previously log destination would be `stdout` and could be changed to `file` using `logging.dest`.

*Impact:* To restore the previous behavior, in `kibana.yml` use the `console` appender to send logs to `stdout`.
[source,yaml]
-------------------
logging:
root:
appenders: [default, console]
-------------------

To send logs to `file` with a given file path, you should define a custom appender with `type:file`:
[source,yaml]
-------------------
logging:
appenders:
file:
type: file
fileName: /var/log/kibana.log
layout:
type: pattern
root:
appenders: [default, file]
-------------------

[float]
==== Specify log event output with root
*Details:* Previously logging output would be specified by `logging.silent` (none), 'logging.quiet' (error messages only) and `logging.verbose` (all).

*Impact:* To restore the previous behavior, in `kibana.yml` specify `logging.root.level` as one of `off`, `error`, `all`:
[source,yaml]
-------------------
# suppress all logs
logging:
root:
appenders: [default]
TinaHeiligers marked this conversation as resolved.
Show resolved Hide resolved
level: off
-------------------

[source,yaml]
-------------------
# only log error messages
logging:
root:
appenders: [default]
level: error
-------------------

[source,yaml]
-------------------
# log all events
logging:
root:
appenders: [default]
level: all
-------------------

[float]
==== Suppress all log output with root
*Details:* Previously all logging output would be suppressed if `logging.silent` was true.

*Impact:* To restore the previous behavior, in `kibana.yml` turn `logging.root.level` to 'off'.
[source,yaml]
-------------------
logging:
root:
appenders: [default]
level: off
-------------------

[float]
==== Suppress log output with root
*Details:* Previously all logging output other than error messages would be suppressed if `logging.quiet` was true.

*Impact:* To restore the previous behavior, in `kibana.yml` turn `logging.root.level` to 'error'.
[source,yaml]
-------------------
logging:
root:
appenders: [default]
level: error
-------------------

[float]
==== Log all output with root
*Details:* Previously all events would be logged if `logging.verbose` was true.

*Impact:* To restore the previous behavior, in `kibana.yml` turn `logging.root.level` to 'all'.
[source,yaml]
-------------------
logging:
root:
appenders: [default]
level: all
-------------------

[float]
==== Declare log message format for each custom appender
*Details:* Previously all events would be logged in `json` format when `logging.json` was true.

*Impact:* To restore the previous behavior, in `kibana.yml` configure the logging format for each custom appender with the `appender.layout` property. There is no default for custom appenders and each one must be configured expilictly.

[source,yaml]
-------------------
logging:
appenders:
custom_console:
type: console
layout:
type: pattern
custom_json:
type: console
layout:
type: json
loggers:
- name: plugins.myPlugin
appenders: [custom_console]
TinaHeiligers marked this conversation as resolved.
Show resolved Hide resolved
root:
appenders: [default, custom_json]
level: warn
-------------------

[float]
==== Configure log rotation with the rolling-file appender
TinaHeiligers marked this conversation as resolved.
Show resolved Hide resolved
*Details:* Previously log rotation would be enabled when `logging.rotate.enabled` was true.

*Impact:* To restore the previous behavior, in `kibana.yml` use the `rolling-file` appender.

[source,yaml]
-------------------
logging:
appenders:
rolling-file:
type: rolling-file
fileName: /var/logs/kibana.log
policy:
type: size-limit
size: 50mb
strategy:
type: numeric
pattern: '-%i'
max: 2
layout:
type: pattern
loggers:
- name: plugins.myPlugin
appenders: [rolling-file]
-------------------

[float]
==== `xpack.security.authProviders` is no longer valid
*Details:* The deprecated `xpack.security.authProviders` setting in the `kibana.yml` file has been removed.
Expand Down
5 changes: 3 additions & 2 deletions packages/kbn-config/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ export interface EnvOptions {
export interface CliArgs {
dev: boolean;
envName?: string;
quiet: boolean;
silent: boolean;
/** @deprecated */
quiet?: boolean;
silent?: boolean;
watch: boolean;
basePath: boolean;
oss: boolean;
Expand Down
9 changes: 6 additions & 3 deletions packages/kbn-legacy-logging/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ import Joi from 'joi';
const HANDLED_IN_KIBANA_PLATFORM = Joi.any().description(
'This key is handled in the new platform ONLY'
);

/**
* @deprecated
*
* Legacy logging has been deprecated and will be removed in 8.0.
* Set up logging from the platform logging instead
*/
export interface LegacyLoggingConfig {
silent: boolean;
quiet: boolean;
Expand All @@ -38,13 +43,11 @@ export const legacyLoggingConfigSchema = Joi.object()
root: HANDLED_IN_KIBANA_PLATFORM,

silent: Joi.boolean().default(false),

quiet: Joi.boolean().when('silent', {
is: true,
then: Joi.boolean().default(true).valid(true),
otherwise: Joi.boolean().default(false),
}),

verbose: Joi.boolean().when('quiet', {
is: true,
then: Joi.valid(false).default(false),
Expand Down
25 changes: 18 additions & 7 deletions src/cli/serve/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
const get = _.partial(_.get, rawConfig);
const has = _.partial(_.has, rawConfig);
const merge = _.partial(_.merge, rawConfig);

if (opts.oss) {
delete rawConfig.xpack;
}
Expand Down Expand Up @@ -112,10 +111,18 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
if (opts.elasticsearch) set('elasticsearch.hosts', opts.elasticsearch.split(','));
if (opts.port) set('server.port', opts.port);
if (opts.host) set('server.host', opts.host);
if (opts.quiet) set('logging.quiet', true);
if (opts.silent) set('logging.silent', true);
if (opts.verbose) set('logging.verbose', true);
if (opts.logFile) set('logging.dest', opts.logFile);
if (opts.silent) {
set('logging.silent', true);
set('logging.root.level', 'off');
}
if (opts.verbose) {
if (has('logging.root.appenders')) {
set('logging.root.level', 'all');
} else {
// Only set logging.verbose to true for legacy logging when KP logging isn't configured.
set('logging.verbose', true);
}
}

set('plugins.scanDirs', _.compact([].concat(get('plugins.scanDirs'), opts.pluginDir)));
set('plugins.paths', _.compact([].concat(get('plugins.paths'), opts.pluginPath)));
Expand All @@ -140,11 +147,14 @@ export default function (program) {
[getConfigPath()]
)
.option('-p, --port <port>', 'The port to bind to', parseInt)
.option('-q, --quiet', 'Prevent all logging except errors')
.option('-q, --quiet', 'Deprecated, set logging level in your configuration')
.option('-Q, --silent', 'Prevent all logging')
.option('--verbose', 'Turns on verbose logging')
.option('-H, --host <host>', 'The host to bind to')
.option('-l, --log-file <path>', 'The file to log to')
.option(
'-l, --log-file <path>',
'Deprecated, set logging file destination in your configuration'
)
.option(
'--plugin-dir <path>',
'A path to scan for plugins, this can be specified multiple ' +
Expand Down Expand Up @@ -204,6 +214,7 @@ export default function (program) {
cliArgs: {
dev: !!opts.dev,
envName: unknownOptions.env ? unknownOptions.env.name : undefined,
// no longer supported
quiet: !!opts.quiet,
silent: !!opts.silent,
watch: !!opts.watch,
Expand Down
Loading