Skip to content

Commit af8725f

Browse files
authored
[Logs+] Add support for logs@custom component template (#95481)
1 parent 4e69fa1 commit af8725f

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

docs/changelog/95481.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 95481
2+
summary: "Add support for `logs@custom` component template for `logs-*-* data streams"
3+
area: Data streams
4+
type: enhancement
5+
issues:
6+
- 95469
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
"Basic logs@custom component template functionality test":
3+
- do:
4+
cluster.put_component_template:
5+
name: logs@custom
6+
body:
7+
template:
8+
settings:
9+
index:
10+
query:
11+
default_field: [ "custom-message" ]
12+
mappings:
13+
properties:
14+
numeric_field:
15+
type: integer
16+
17+
- do:
18+
indices.create_data_stream:
19+
name: logs-generic-default
20+
- is_true: acknowledged
21+
22+
- do:
23+
indices.get_data_stream:
24+
name: logs-generic-default
25+
- set: { data_streams.0.indices.0.index_name: idx0name }
26+
27+
- do:
28+
indices.get_settings:
29+
index: $idx0name
30+
# verify that the custom settings.index.query.default_field overrides the default query field - "message"
31+
- match: { .$idx0name.settings.index.query.default_field: ["custom-message"] }
32+
33+
- do:
34+
indices.get_mapping:
35+
index: $idx0name
36+
# verify that the new field from the custom component template is applied
37+
- match: { .$idx0name.mappings.properties.numeric_field.type: "integer" }

x-pack/plugin/core/src/main/resources/logs-template.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
"composed_of": [
66
"logs-mappings",
77
"data-streams-mappings",
8-
"logs-settings"
8+
"logs-settings",
9+
"logs@custom"
910
],
11+
"ignore_missing_component_templates": ["logs@custom"],
1012
"allow_auto_create": true,
1113
"_meta": {
1214
"description": "default logs template installed by x-pack",

0 commit comments

Comments
 (0)