Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/changelog/125606.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pr: 125606
summary: Rename deprecation index template
area: Logging
type: breaking
issues:
- 125445
breaking:
title: Rename deprecation index template
area: Logging
details: The deprecation datastream contains log entries for deprecations that
occured while Elasticsearch is running. The deprecation log entries had a
mismatch in their dataset name. In order to avoid changing the dataset
name in the existing datastream, a new datastream now exists.
impact: If querying for deprecations previously using the
`.logs-deprecation.elasticsearch-default` datastream, you should now use the
`.logs-elasticsearch.deprecation-default` datastream.
notable: false
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"index_patterns": [".logs-deprecation.*"],
"index_patterns": ["${xpack.deprecation.indexing.template.pattern}"],
"priority": 1000,
"data_stream": {
"hidden": true
Expand All @@ -13,5 +13,6 @@
"description": "default template for Stack deprecation logs index template installed by x-pack",
"managed": true
},
"deprecated": ${xpack.deprecation.indexing.template.deprecated},
"version": ${xpack.deprecation.indexing.template.version}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class DeprecationTestUtils {
/**
* Same as <code>DeprecationIndexingAppender#DEPRECATION_MESSAGES_DATA_STREAM</code>, but that class isn't visible from here.
*/
public static final String DATA_STREAM_NAME = ".logs-deprecation.elasticsearch-default";
public static final String DATA_STREAM_NAME = ".logs-elasticsearch.deprecation-default";

static List<Map<String, Object>> getIndexedDeprecations(RestClient client) throws IOException {
return getIndexedDeprecations(client, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@Plugin(name = "DeprecationIndexingAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE)
public class DeprecationIndexingAppender extends AbstractAppender {
private static final Logger logger = LogManager.getLogger(DeprecationIndexingAppender.class);
public static final String DEPRECATION_MESSAGES_DATA_STREAM = ".logs-deprecation.elasticsearch-default";
public static final String DEPRECATION_MESSAGES_DATA_STREAM = ".logs-elasticsearch.deprecation-default";

private final Consumer<IndexRequest> requestConsumer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void clusterChanged(ClusterChangedEvent event) {
}
final IndexLifecycleMetadata indexLifecycleMetadata = event.state().metadata().getProject().custom(IndexLifecycleMetadata.TYPE);

if (event.state().getMetadata().getProject().templatesV2().containsKey(".deprecation-indexing-template")
if (event.state().getMetadata().getProject().templatesV2().containsKey(".deprecation-indexing-template-9")
&& indexLifecycleMetadata != null
&& indexLifecycleMetadata.getPolicies().containsKey(".deprecation-indexing-ilm-policy")) {
flushEnabled.set(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
public class DeprecationIndexingTemplateRegistry extends IndexTemplateRegistry {
// history (please add a comment why you increased the version here)
// version 1: initial
public static final int INDEX_TEMPLATE_VERSION = 1;
// version 2: deprecated old name and renamed index pattern
public static final int INDEX_TEMPLATE_VERSION = 2;

public static final String DEPRECATION_INDEXING_TEMPLATE_VERSION_VARIABLE = "xpack.deprecation.indexing.template.version";

public static final String DEPRECATION_INDEXING_MAPPINGS_NAME = ".deprecation-indexing-mappings";
public static final String DEPRECATION_INDEXING_SETTINGS_NAME = ".deprecation-indexing-settings";
public static final String DEPRECATION_INDEXING_TEMPLATE_NAME = ".deprecation-indexing-template";
public static final String DEPRECATION_INDEXING_TEMPLATE_NAME_OLD = ".deprecation-indexing-template";
public static final String DEPRECATION_INDEXING_TEMPLATE_NAME = ".deprecation-indexing-template-9";
public static final String DEPRECATION_INDEXING_POLICY_NAME = ".deprecation-indexing-ilm-policy";

public DeprecationIndexingTemplateRegistry(
Expand Down Expand Up @@ -89,7 +91,25 @@ protected Map<String, ComponentTemplate> getComponentTemplateConfigs() {
DEPRECATION_INDEXING_TEMPLATE_NAME,
"/deprecation/deprecation-indexing-template.json",
INDEX_TEMPLATE_VERSION,
DEPRECATION_INDEXING_TEMPLATE_VERSION_VARIABLE
DEPRECATION_INDEXING_TEMPLATE_VERSION_VARIABLE,
Map.of(
"xpack.deprecation.indexing.template.deprecated",
"false",
"xpack.deprecation.indexing.template.pattern",
".logs-elasticsearch.deprecation-*"
)
),
new IndexTemplateConfig(
DEPRECATION_INDEXING_TEMPLATE_NAME_OLD,
"/deprecation/deprecation-indexing-template.json",
INDEX_TEMPLATE_VERSION,
DEPRECATION_INDEXING_TEMPLATE_VERSION_VARIABLE,
Map.of(
"xpack.deprecation.indexing.template.deprecated",
"true",
"xpack.deprecation.indexing.template.pattern",
".logs-deprecation.*"
)
)
);

Expand Down
Loading