-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit ecf1c57) Co-authored-by: Mike Birnstiehl <[email protected]>
- Loading branch information
1 parent
bd82343
commit dfcf292
Showing
3 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
[[logs-index-template]] | ||
= Logs index template reference | ||
|
||
Index templates are used to configure the backing indices of data streams as they're created. | ||
These index templates are composed of multiple {ref}/indices-component-template.html[component templates]—reusable building blocks | ||
that configure index mappings, settings, and aliases. | ||
|
||
You can view the default `logs` index template in {kib}. | ||
Navigate to **{stack-manage-app}** → **Index Management** → **Index Templates**, and search for `logs`. | ||
Select the `logs` index templates to view relevant component templates. | ||
|
||
[discrete] | ||
[[custom-logs-template-edit]] | ||
== Edit the `logs` index template | ||
|
||
The default `logs` index template for the `logs-*-*` index pattern is composed of the following component templates: | ||
|
||
* `logs@mappings` | ||
* `logs@settings` | ||
* `logs@custom` | ||
* `ecs@mappings` | ||
|
||
You can use the `logs@custom` component template to customize your {es} indices. The `logs@custom` component template is not installed by default, but you can create a component template named `logs@custom` to override and extend default mappings or settings. To do this: | ||
|
||
. Open {kib} and navigate to **{stack-manage-app}** → **Index Management** → **Component Templates**. | ||
. Click *Create component template*. | ||
. Name the component template logs@custom. | ||
. Add any custom metadata, index settings, or mappings. | ||
|
||
Changes to component templates are not applied retroactively to existing indices. For changes to take effect, create a new write index for impacted data streams by triggering a rollover. Do this using the {es} {ref}/indices-rollover-index.html[Rollover API]. For example, to roll over the `logs-generic-default` data stream, run: | ||
|
||
[source,console] | ||
---- | ||
POST /logs-generic-default/_rollover/ | ||
---- | ||
|
||
[discrete] | ||
[[custom-logs-template-default-field]] | ||
=== Set the `default_field` using the custom template | ||
|
||
The `logs` index template uses `default_field: [*]` meaning queries without specified fields will search across all fields. | ||
You can update the `default_field` to search in the `message` field instead of all fields using the `logs@custom` component template. | ||
|
||
If you haven't already created the `logs@custom`component template, create it as outlined in the previous section. Then, follow these steps to update the *Index settings* of the component template: | ||
|
||
. Open {kib} and navigate to **{stack-manage-app}** → **Index Management** → **Component Templates**. | ||
. Search for `logs` and find the `logs@custom` component template. | ||
. Open the **Actions** menu and select **Edit**. | ||
. Select **Index settings** and add the following code: | ||
+ | ||
[source,json] | ||
---- | ||
{ | ||
"index": { | ||
"query": { | ||
"default_field": [ | ||
"message" | ||
] | ||
} | ||
} | ||
} | ||
---- | ||
. Click **Next** through to the **Review** page and save the component template. |