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

Start consuming np logging config #56480

Merged
merged 11 commits into from
Feb 4, 2020

Conversation

mshustov
Copy link
Contributor

Summary

The platform starts handling the new logging config.
Removed receiveAllAppenders flag, since it breaks compatibility with the legacy config settings: silent & quiet.
Added based integration tests. I will add more to make sure compatibility (when possible) with the legacy log record format.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

Dev docs

Provides experimental support of new logging format for new platform plugins. More about logging format: https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.md

@mshustov mshustov added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. v7.7.0 labels Jan 31, 2020
@mshustov mshustov requested a review from a team as a code owner January 31, 2020 11:20
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@mshustov mshustov added the WIP Work in progress label Jan 31, 2020

expect(getPlatformLogsFromMock(mockConsoleLog)).toMatchInlineSnapshot(`
Array [
"[xxxx-xx-xxTxx:xx:xx.xxxZ][INFO ][test-file] info",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can stripe timestamps. I decided to keep it to see the difference in the format until we have separate tests for them.

const loggingConfig = {
appenders: {
default: { kind: 'legacy-appender', legacyLoggingConfig: configValue },
...appenders,
default: { kind: 'legacy-appender', legacyLoggingConfig },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrites a default appender

this.appenders.set(appenderKey, appenderSchema);

@mshustov mshustov removed the WIP Work in progress label Jan 31, 2020
},
root: { level: 'info' },
root: { level: 'info', ...root },
Copy link
Contributor Author

@mshustov mshustov Feb 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: We allow users to configure roots. Although if a user specifies root.appenders without defaults NP logging service won't send logs to the legacy system. I think logging a warning is enough because I don't want to extend user-defined config value, nor enforce default value presence in root.appenders(since we will remove this logic in v8). WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging a warning makes sense to me 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added config validation to prevent server start

Copy link
Contributor

@joshdover joshdover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, worked as expected.

src/core/server/logging/logger.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. My only concern is that during the transition period, when NP logger/appender are configured, there will be formatting differences between messages logged to the 'legacy' console and messages logged with the NP loggers. But that probably can't be avoided.

@mshustov
Copy link
Contributor Author

mshustov commented Feb 4, 2020

My only concern is that during the transition period, when NP logger/appender are configured, there will be formatting differences between messages logged to the 'legacy' console and messages logged with the NP loggers. But that probably can't be avoided.

Yes, I'm about to start working on record format. TBH I don't think it's a bit problem because if you want to use the new config format you kinda expect that output has a different form.
Also, I'd like to avoid the long-lived branch that we merge once and realize that something broken. But with the current PR, we already can start testing logging functionality for migrated plugins.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@mshustov mshustov added the v8.0.0 label Feb 4, 2020
@mshustov mshustov merged commit a36ec32 into elastic:master Feb 4, 2020
@mshustov mshustov deleted the start-consuming-np-logging-config branch February 4, 2020 11:38
mshustov added a commit to mshustov/kibana that referenced this pull request Feb 4, 2020
* pass config to the new platform

* add default appenders

* remove receiveAllAppenders flag

it breaks legacy-appender compatibility with legacy flags: silent, quiet, verbose

* add integration tests

* use console mocks  to simplify test setup

* update tests

* improve names

* validate that default appender always presents on root level

required during migration period to make sure logs are sent to the LP logging system

* do not check condition in the loop

* fix integration tests
mshustov added a commit that referenced this pull request Feb 4, 2020
* pass config to the new platform

* add default appenders

* remove receiveAllAppenders flag

it breaks legacy-appender compatibility with legacy flags: silent, quiet, verbose

* add integration tests

* use console mocks  to simplify test setup

* update tests

* improve names

* validate that default appender always presents on root level

required during migration period to make sure logs are sent to the LP logging system

* do not check condition in the loop

* fix integration tests
gmmorris added a commit to gmmorris/kibana that referenced this pull request Feb 4, 2020
* master: (42 commits)
  Move kuery_autocomplete ⇒ NP (elastic#56607)
  [ML] Functional tests - stabilize job row and analytics result view assertions (elastic#56595)
  [Discover] Inline angular directives only used in this plugin (elastic#56119)
  [Discover] Migrate get_sort.js test from mocha to TypeScript (elastic#56011)
  [SIEM] Enable flow_target_select_connected unit tests (elastic#55618)
  Start consuming np logging config (elastic#56480)
  [SIEM] Add eslint-plugin-react-perf (elastic#55960)
  Mention changed SAML ACS endpoint URL in breaking changes doc. (elastic#56613)
  Add `getServerInfo` API to http setup contract (elastic#56636)
  Updates Monitoring alert Jest snapshots
  Kibana property config migrations (elastic#55937)
  Vislib replacement toggle (elastic#56439)
  [Uptime] Add unit tests for QueryContext time calculation (elastic#56671)
  [SIEM][Detection Engine] Critical blocker, fixes pre-packaged rule miscounts
  Upgrade EUI to v18.3.0 (elastic#56228)
  [Maps] Fix server log (elastic#56679)
  [SIEM] Fixes FTUE when APM node is present (elastic#56574)
  [Reporting/FieldFormats] expose `setFieldFormats` and call from ReportingPlugin.start (elastic#56563)
  Update EMS API urls for production (elastic#56657)
  Ability to delete alerts even when AAD is out of sync (elastic#56543)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Feature:New Platform release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants