Skip to content

Commit

Permalink
[8.0] Remove legacy logging (#112305)
Browse files Browse the repository at this point in the history
* 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 78d5560.

* 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>
  • Loading branch information
pgayvallet and Tyler Smalley authored Oct 5, 2021
1 parent 158b396 commit a4b74bd
Show file tree
Hide file tree
Showing 94 changed files with 108 additions and 4,882 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@
/packages/kbn-std/ @elastic/kibana-core
/packages/kbn-config/ @elastic/kibana-core
/packages/kbn-logging/ @elastic/kibana-core
/packages/kbn-legacy-logging/ @elastic/kibana-core
/packages/kbn-crypto/ @elastic/kibana-core
/packages/kbn-http-tools/ @elastic/kibana-core
/src/plugins/saved_objects_management/ @elastic/kibana-core
Expand Down
30 changes: 19 additions & 11 deletions config/kibana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,32 @@
# Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable.
#elasticsearch.shardTimeout: 30000

# Logs queries sent to Elasticsearch. Requires logging.verbose set to true.
#elasticsearch.logQueries: false

# Specifies the path where Kibana creates the process ID file.
#pid.file: /run/kibana/kibana.pid

# Set the value of this setting to off to suppress all logging output, or to debug to log everything.
# logging.root.level: debug

# Enables you to specify a file where Kibana stores log output.
#logging.dest: stdout
# logging.appenders.default:
# type: file
# fileName: /var/logs/kibana.log


# Set the value of this setting to true to suppress all logging output.
#logging.silent: false
# Logs queries sent to Elasticsearch.
# logging.loggers:
# - name: elasticsearch.queries
# level: debug

# Set the value of this setting to true to suppress all logging output other than error messages.
#logging.quiet: false
# Logs http responses.
# logging.loggers:
# - name: http.server.response
# level: debug

# Set the value of this setting to true to log all events, including system usage information
# and all requests.
#logging.verbose: false
# Logs system usage information.
# logging.loggers:
# - name: metrics.ops
# level: debug

# Set the interval in milliseconds to sample system and process performance
# metrics. Minimum is 100ms. Defaults to 5000.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,5 @@ you can override the flags with:

|--verbose| --logging.root.level=debug --logging.root.appenders[0]=default --logging.root.appenders[1]=custom | --verbose

|--quiet| --logging.root.level=error --logging.root.appenders[0]=default --logging.root.appenders[1]=custom | not supported

|--silent| --logging.root.level=off | --silent
|===

NOTE: To preserve backwards compatibility, you are required to pass the root `default` appender until the legacy logging system is removed in `v8.0`.
1 change: 0 additions & 1 deletion docs/developer/getting-started/monorepo-packages.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ yarn kbn watch
- @kbn/i18n
- @kbn/interpreter
- @kbn/io-ts-utils
- @kbn/legacy-logging
- @kbn/logging
- @kbn/mapbox-gl
- @kbn/monaco
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
<b>Signature:</b>

```typescript
export declare type AppenderConfigType = ConsoleAppenderConfig | FileAppenderConfig | LegacyAppenderConfig | RewriteAppenderConfig | RollingFileAppenderConfig;
export declare type AppenderConfigType = ConsoleAppenderConfig | FileAppenderConfig | RewriteAppenderConfig | RollingFileAppenderConfig;
```
10 changes: 0 additions & 10 deletions docs/settings/logging-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@

Refer to the <<log-settings-examples, examples>> for common configuration use cases. To learn more about possible configuration values, go to {kibana-ref}/logging-service.html[{kib}'s Logging service].

[[log-settings-compatibility]]
==== Backwards compatibility
Compatibility with the legacy logging system is assured until the end of the `v7` version.
All log messages handled by `root` context (default) are forwarded to the legacy logging service.
The logging configuration is validated against the predefined schema and if there are
any issues with it, {kib} will fail to start with the detailed error message.

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.

[[log-settings-examples]]
==== Examples
Here are some configuration examples for the most common logging use cases:
Expand Down
11 changes: 10 additions & 1 deletion docs/user/production-considerations/production.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,21 @@ server.name
Settings unique across each host (for example, running multiple installations on the same virtual machine):
[source,js]
--------
logging.dest
path.data
pid.file
server.port
--------

When using a file appender, the target file must also be unique:
[source,yaml]
--------
logging:
appenders:
default:
type: file
fileName: /unique/path/per/instance
--------

Settings that must be the same:
[source,js]
--------
Expand Down
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"@elastic/ems-client": "7.15.0",
"@elastic/eui": "38.0.1",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "^9.0.1-kibana3",
"@elastic/maki": "6.3.0",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
Expand All @@ -113,12 +112,10 @@
"@hapi/accept": "^5.0.2",
"@hapi/boom": "^9.1.4",
"@hapi/cookie": "^11.0.2",
"@hapi/good-squeeze": "6.0.0",
"@hapi/h2o2": "^9.1.0",
"@hapi/hapi": "^20.2.0",
"@hapi/hoek": "^9.2.0",
"@hapi/inert": "^6.0.4",
"@hapi/podium": "^4.1.3",
"@hapi/wreck": "^17.1.0",
"@kbn/ace": "link:bazel-bin/packages/kbn-ace",
"@kbn/alerts": "link:bazel-bin/packages/kbn-alerts",
Expand All @@ -133,7 +130,6 @@
"@kbn/i18n": "link:bazel-bin/packages/kbn-i18n",
"@kbn/interpreter": "link:bazel-bin/packages/kbn-interpreter",
"@kbn/io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils",
"@kbn/legacy-logging": "link:bazel-bin/packages/kbn-legacy-logging",
"@kbn/logging": "link:bazel-bin/packages/kbn-logging",
"@kbn/mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl",
"@kbn/monaco": "link:bazel-bin/packages/kbn-monaco",
Expand Down
1 change: 0 additions & 1 deletion packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ filegroup(
"//packages/kbn-i18n:build",
"//packages/kbn-interpreter:build",
"//packages/kbn-io-ts-utils:build",
"//packages/kbn-legacy-logging:build",
"//packages/kbn-logging:build",
"//packages/kbn-mapbox-gl:build",
"//packages/kbn-monaco:build",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-cli-dev-mode/src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface BootstrapArgs {
}

export async function bootstrapDevMode({ configs, cliArgs, applyConfigOverrides }: BootstrapArgs) {
const log = new CliLog(!!cliArgs.quiet, !!cliArgs.silent);
const log = new CliLog(!!cliArgs.silent);

const env = Env.createDefault(REPO_ROOT, {
configs,
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const createCliArgs = (parts: Partial<SomeCliArgs> = {}): SomeCliArgs => ({
runExamples: false,
watch: true,
silent: false,
quiet: false,
...parts,
});

Expand Down
5 changes: 2 additions & 3 deletions packages/kbn-cli-dev-mode/src/cli_dev_mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const GRACEFUL_TIMEOUT = 30000;

export type SomeCliArgs = Pick<
CliArgs,
| 'quiet'
| 'silent'
| 'verbose'
| 'disableOptimizer'
Expand Down Expand Up @@ -108,7 +107,7 @@ export class CliDevMode {
private subscription?: Rx.Subscription;

constructor({ cliArgs, config, log }: { cliArgs: SomeCliArgs; config: CliDevConfig; log?: Log }) {
this.log = log || new CliLog(!!cliArgs.quiet, !!cliArgs.silent);
this.log = log || new CliLog(!!cliArgs.silent);

if (cliArgs.basePath) {
this.basePathProxy = new BasePathProxyServer(this.log, config.http, config.dev);
Expand Down Expand Up @@ -163,7 +162,7 @@ export class CliDevMode {
runExamples: cliArgs.runExamples,
cache: cliArgs.cache,
dist: cliArgs.dist,
quiet: !!cliArgs.quiet,
quiet: false,
silent: !!cliArgs.silent,
verbose: !!cliArgs.verbose,
watch: cliArgs.watch,
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-cli-dev-mode/src/dev_server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ describe('#run$', () => {
Array [
"foo",
"bar",
"--logging.json=false",
],
Object {
"env": Object {
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-cli-dev-mode/src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ export interface Log {

export class CliLog implements Log {
public toolingLog = new ToolingLog({
level: this.silent ? 'silent' : this.quiet ? 'error' : 'info',
level: this.silent ? 'silent' : 'info',
writeTo: {
write: (msg) => {
this.write(msg);
},
},
});

constructor(private readonly quiet: boolean, private readonly silent: boolean) {}
constructor(private readonly silent: boolean) {}

good(label: string, ...args: any[]) {
if (this.quiet || this.silent) {
if (this.silent) {
return;
}

Expand All @@ -41,7 +41,7 @@ export class CliLog implements Log {
}

warn(label: string, ...args: any[]) {
if (this.quiet || this.silent) {
if (this.silent) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-cli-dev-mode/src/using_server_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function usingServerProcess<T>(
) {
return Rx.using(
(): ProcResource => {
const proc = execa.node(script, [...argv, '--logging.json=false'], {
const proc = execa.node(script, argv, {
stdio: 'pipe',
nodeOptions: [
...process.execArgv,
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-config/src/__mocks__/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export function getEnvOptions(options: DeepPartial<EnvOptions> = {}): EnvOptions
configs: options.configs || [],
cliArgs: {
dev: true,
quiet: false,
silent: false,
watch: false,
basePath: false,
Expand Down
6 changes: 0 additions & 6 deletions packages/kbn-config/src/__snapshots__/env.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/kbn-config/src/config_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
DeprecatedConfigDetails,
ChangedDeprecatedPaths,
} from './deprecation';
import { LegacyObjectToConfigAdapter } from './legacy';
import { ObjectToConfigAdapter } from './object_to_config_adapter';

/** @internal */
export type IConfigService = PublicMethodsOf<ConfigService>;
Expand Down Expand Up @@ -71,7 +71,7 @@ export class ConfigService {
map(([rawConfig, deprecations]) => {
const migrated = applyDeprecations(rawConfig, deprecations);
this.deprecatedConfigPaths.next(migrated.changedPaths);
return new LegacyObjectToConfigAdapter(migrated.config);
return new ObjectToConfigAdapter(migrated.config);
}),
tap((config) => {
this.lastConfig = config;
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-config/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export interface EnvOptions {
export interface CliArgs {
dev: boolean;
envName?: string;
/** @deprecated */
quiet?: boolean;
silent?: boolean;
verbose?: boolean;
watch: boolean;
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ export { Config, ConfigPath, isConfigPath, hasConfigPathIntersection } from './c
export { ObjectToConfigAdapter } from './object_to_config_adapter';
export { CliArgs, Env, RawPackageInfo } from './env';
export { EnvironmentMode, PackageInfo } from './types';
export { LegacyObjectToConfigAdapter, LegacyLoggingConfig } from './legacy';
export { getPluginSearchPaths } from './plugins';
Loading

0 comments on commit a4b74bd

Please sign in to comment.