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

Surface deprecation logs from Kibana CI #120043

Open
2 tasks done
rudolf opened this issue Nov 30, 2021 · 1 comment
Open
2 tasks done

Surface deprecation logs from Kibana CI #120043

rudolf opened this issue Nov 30, 2021 · 1 comment
Labels
Team:Operations Team label for Operations Team

Comments

@rudolf
Copy link
Contributor

rudolf commented Nov 30, 2021

To help teams audit, fix and suppress deprecation warnings originating from Elastic products we need to instrument Kibana CI.

Short term:

  • Surface deprecation warnings in CI logs
  • Provide the necessary context to make it easy for teams to action
    1. Which test triggered the deprecation log
    2. The complete query that caused the deprecation log
    3. A stack trace (the nature of Nodejs means stack traces aren't always useful in 8.x. Due to the architecture of the elasticsearch-js client 7.x stack traces are never useful)

Medium term: @elastic/kibana-operations
Create a workflow/process to manage deprecation logs in Kibana

  1. PR's fail if they introduce new deprecation logs. These can be ignored by adding them to an ignored_deprecations file which uses the deprecation message and test name as unique keys.
  2. If ES promotion fails due to new deprecation logs, the operations team will add the new logs to the ignored_deprecations file and create an issue for the respective team to address.

We should distinguish between log originating from user supplied queries (e.g. console), kibana or originating from test suites themselves.

There are several ways we could surface deprecation logs:

1. Deprecation logger to stdout

By setting the following log4j2.properties we can direct deprecation logs in JSON format to stdout. The ToolingLog could then write these to file so that they appear in the final CI logs.

appender.deprecation_console.type = Console
appender.deprecation_console.name = deprecation_console
appender.deprecation_console.layout.type = ECSJsonLayout
appender.deprecation_console.layout.dataset = deprecation.elasticsearch

logger.deprecation.name = org.elasticsearch.deprecation
logger.deprecation.level = WARN
logger.deprecation.appenderRef.deprecation_console.ref = deprecation_console
logger.deprecation.appenderRef.header_warning.ref = header_warning
logger.deprecation.additivity = false

Example log line:

{
    "@timestamp": "2021-11-30T22:42:27.955Z",
    "log.level": "CRITICAL",
    "data_stream.dataset": "deprecation.elasticsearch",
    "data_stream.namespace": "default",
    "data_stream.type": "logs",
    "ecs.version": "1.7",
    "elasticsearch.event.category": "api",
    "event.code": "open_system_index_access",
    "message": "this request accesses system indices: [.kibana_8.0.0_001], but in a future major version, direct access to system indices will be prevented by default",
    "service.name": "ES_ECS",
    "process.thread.name": "elasticsearch[rudolf-elastic-mbp.home][system_critical_read][T#2]",
    "log.logger": "org.elasticsearch.deprecation.cluster.metadata.IndexNameExpressionResolver",
    "event.dataset": "deprecation.elasticsearch",
    "elasticsearch.cluster.uuid": "sod7KxtGQiCckgLNfaQMcA",
    "elasticsearch.node.id": "LBLoRyyaQduqJjvampkubQ",
    "elasticsearch.node.name": "rudolf-elastic-mbp.home",
    "elasticsearch.cluster.name": "elasticsearch"
}

2. warning response header

Each API request that triggers a deprecation will include a warning header in it's response for example:

299 Elasticsearch-8.1.0-SNAPSHOT-fe7c2d59d80ae9f75c513f7d89879acef665ebe0 "this request accesses system indices: [.kibana_task_manager_8.1.0_001], but in a future major version, direct access to system indices will be prevented by default"

Similar to how elasticsearch.query logger context (previously elasticsearch.logQueries config option) works, we can log a lot of extra context like the entire query and the stack trace:

ES DEPRECATION: 299 Elasticsearch-8.1.0-SNAPSHOT-fe7c2d59d80ae9f75c513f7d89879acef665ebe0 "this request accesses system indices: [.kibana_task_manager_8.1.0_001], but in a future major version, direct access to system indices will be prevented by default"
Origin: kibana
Stack trace:
    at ApmClient.DeleteApi [as delete](/Users/rudolf/dev/kibana/node_modules/@elastic/elasticsearch/src/api/api/delete.ts:59:10)
Query:
404
DELETE /.kibana_task_manager_8.1.0/_doc/task%3Adata_enhanced_search_sessions_cleanup?refresh=wait_for

3. Query the .ds-.logs-deprecation.elasticsearch-default

We explored this approach in #117937 but this provides the least context since we can only collect the deprecation logs at a set interval or time, e.g. at the end of a test suite, making it hard to trace back to the offending test and even harder to the corresponding line of source code.

@rudolf rudolf added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Nov 30, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Operations Team label for Operations Team
Projects
None yet
Development

No branches or pull requests

2 participants