Skip to content

Write deprecation logs to a data stream #61966

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

Merged

Conversation

pugnascotia
Copy link
Contributor

Backport of #58924.

Closes #46106. Introduce a mechanism for writing deprecation logs to a data stream as well as to disk.

Test by running ./gradlew run and then:

curl -u elastic-admin:elastic-password http://localhost:9200/_flush/synced?pretty
curl -u elastic-admin:elastic-password http://localhost:9200/logs-deprecation-elasticsearch/_search?pretty

This implementation reworks deprecation logging to rely on log4j by introducing filters and appenders, and a custom log level. The existing deprecation X-Pack plugin simply configures an extra appender to capture messages to an index. A "component" class manages most of the interface between the cluster and the appender.

This approach can be extended for other types of logging, e.g. security by introducing further custom log levels.

Backport of elastic#61484.

Closes elastic#46106. Implement a new log4j appender for deprecation logging, in
order to write logs to a dedicated data stream. This is controlled by a new
setting, `cluster.deprecation_indexing.enabled`.
@pugnascotia pugnascotia marked this pull request as ready for review September 4, 2020 14:58
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Logging)

@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Sep 4, 2020
@pugnascotia pugnascotia requested a review from pgomulka September 4, 2020 14:59
@pugnascotia
Copy link
Contributor Author

@pgomulka would you mind reviewing this backport, please? I was caught out by ESJsonLayout not generating ECS, and the simplest solution seemed to be forking it for 7.x. I plan to forward-port the extra logging in DeprecationIndexingComponent as well.

Copy link
Contributor

@pgomulka pgomulka left a comment

Choose a reason for hiding this comment

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

I like the idea with forward fork
backporting ecs json changes to 7.x would break the json we introduced in 7.0 so would be annoying to users
LGTM when build is green

@pugnascotia pugnascotia merged commit b7fd7cf into elastic:7.x Sep 9, 2020
@pugnascotia pugnascotia deleted the 46106-index-deprecation-logs-7x branch September 9, 2020 11:16
@pugnascotia
Copy link
Contributor Author

Note that these changes were removed from 7.10 in #63942.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Core/Infra/Logging Log management and logging utilities >enhancement Team:Core/Infra Meta label for core/infra team v7.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants