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

Write deprecation logs to a data stream #61484

Merged

Conversation

pugnascotia
Copy link
Contributor

Closes #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.

Depends on #61474.

Test by running ./gradlew run and then:

AUTH="elastic-admin:elastic-password"

# Enable new setting
curl -u $AUTH -XPUT \
  --data '{ "transient": { "cluster.deprecation_indexing.enabled": true } }' \
  http://localhost:9200/_cluster/settings 

# Trigger deprecation warning
curl -u $AUTH http://localhost:9200/_flush/synced?pretty

# Show indexed deprecation messages
curl -u $AUTH http://localhost:9200/logs-deprecation-elasticsearch/_search?pretty

@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 Aug 24, 2020
@pugnascotia pugnascotia force-pushed the 46106-index-deprecation-logs branch from 9125b65 to 126f0ca Compare August 25, 2020 10:28
@pugnascotia
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/packaging-sample-windows

Copy link
Contributor

@jakelandis jakelandis left a comment

Choose a reason for hiding this comment

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

looking good. a couple of comments and a PR to this PR pugnascotia#3 (to ensure using the latest testing plugins)

update gradle config for new testing plugins
Copy link
Contributor

@jakelandis jakelandis 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 and worked great! LGTM

.field("data_stream.type", "logs")
.field("data_stream.datatype", "deprecation")
.field("data_stream.namespace", "elasticsearch")
.field("ecs.version", ECS_VERSION)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jakelandis how do these look to you?

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

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.

LGTM,
we would need to update beats test samples (with new fields). I can help with this.

@pugnascotia pugnascotia merged commit dce2ef9 into elastic:master Sep 3, 2020
@pugnascotia pugnascotia deleted the 46106-index-deprecation-logs branch September 3, 2020 13:50
pugnascotia added a commit to pugnascotia/elasticsearch that referenced this pull request Sep 4, 2020
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`.
return new ESLogMessage(messagePattern, args)
.field("data_stream.type", "logs")
.field("data_stream.datatype", "deprecation")
Copy link
Contributor

Choose a reason for hiding this comment

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

@pugnascotia This should be data_stream.dataset to be aligned with the indexing strategy.

I would also propose to keep the namespace as default and use deprecation.elasticsearch as the dataset name. Only important thing is that the dataset does not contain a -.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ruflin so would we have the following, then?

    .field("data_stream.dataset", "default")
    .field("data_stream.namespace", "deprecation.elasticsearch")

Copy link
Contributor

Choose a reason for hiding this comment

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

No, the other way around:

.field("data_stream.dataset", "deprecation.elasticsearch")
.field("data_stream.namespace", "default")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll get that changed 👍

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

Successfully merging this pull request may close these issues.

Write deprecation logs to an index
5 participants