Skip to content

Commit ef0d9d7

Browse files
mdbirnstiehlrhr323
authored andcommitted
Add failed docs rule (elastic#3094)
This PR closes elastic#2709 and show users how to create a failed docs alert using the custom threshold rule.
1 parent cd86f56 commit ef0d9d7

File tree

3 files changed

+178
-0
lines changed

3 files changed

+178
-0
lines changed
219 KB
Loading
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
---
2+
navigation_title: Failed docs
3+
products:
4+
- id: observability
5+
- id: cloud-serverless
6+
applies_to:
7+
stack: ga 9.1
8+
serverless: ga
9+
---
10+
11+
# Create a failed docs rule [observability-create-failed-docs-rule]
12+
13+
14+
::::{note}
15+
16+
The **Editor** role or higher is required to create a failed docs rule using custom threshold rule. To learn more, refer to [Assign user roles and privileges](/deploy-manage/users-roles/cloud-organization/user-roles.md#general-assign-user-roles).
17+
18+
::::
19+
20+
Create a failed docs rule using the [custom threshold rule](../incident-management/create-custom-threshold-rule.md) to alert when the number of failed documents in your data stream reaches or exceeds a given value.
21+
22+
:::{image} /solutions/images/failed-docs-rule.png
23+
:alt: Create failed docs rule using the custom threshold rule type
24+
:screenshot:
25+
:::
26+
27+
When creating a failed docs rule, the process depends on your deployment type and your space's solution view. You can check your solution view by selecting the **Spaces** icon.
28+
29+
Select the appropriate tab for your setup, then follow the instructions to create a failed docs rule:
30+
31+
::::{tab-set}
32+
33+
:::{tab-item} Serverless and Observability solution view
34+
1. From the main menu, open the **Data Set Quality** page from **Management****Stack Management**, or use the [global search field](/explore-analyze/find-and-organize/find-apps-and-objects.md).
35+
1. Find the data set you want to create a rule for in the table, and select **Open** from the **Actions** column.
36+
1. Select **Alerts****Create custom threshold rule**.
37+
1. Select **Add aggregation/field**.
38+
1. For your new aggregation, set **Aggregation type** to **Count** and **KQL Filter** to `_index : ".fs*"`.
39+
1. Select **Equation**, and set the equation to `(B / A) * 100`.
40+
1. Set **Is above** to the desired threshold. For example, `1.5`.
41+
1. Set the **Label** to `Failed docs`.
42+
1. Select **Next** to go to the **Details** step.
43+
1. Set the **Rule name** to `Data set quality` and add `failed_docs` to the **Tags**.
44+
1. Select **Create rule**.
45+
:::
46+
47+
:::{tab-item} Classic solution view
48+
1. Select **Manage rules and connectors**.
49+
1. Select **Create rule**, then **Custom threshold**.
50+
1. Select **Data view**, then **Create a data view**.
51+
1. Find your data stream under **All sources**.
52+
1. Name your data view.
53+
1. Add your index pattern with `::failures` appended. For example, `logs-synth.2-default::data,logs-synth.2-default::failures`.
54+
1. Select **Save data view to Kibana**.
55+
1. Select **Add aggregation/field**.
56+
1. For your new aggregation, set **Aggregation type** to **Count** and **KQL Filter** to `_index : ".fs*"`.
57+
1. Select **Equation**, and set the equation to `(B / A) * 100`.
58+
1. Set **Is above** to the desired threshold. For example, `1.5`.
59+
1. Set the **Label** to `Failed docs`.
60+
1. Select **Next** to go to the **Details** menu.
61+
1. Set the **Rule name** to `Data set quality` and add `failed_docs` to the **Tags**.
62+
1. Select **Create rule**.
63+
:::
64+
65+
::::
66+
67+
## Add actions [observability-create-failed-docs-alert-rule-add-actions]
68+
69+
You can extend your rules with actions that interact with third-party systems, write to logs or indices, or send user notifications. You can add an action to a rule at any time. You can create rules without adding actions, and you can also define multiple actions for a single rule.
70+
71+
To add actions to rules, you must first create a connector for that service (for example, an email or external incident management system), which you can then use for different rules, each with their own action frequency.
72+
73+
:::::{dropdown} Connector types
74+
Connectors provide a central place to store connection information for services and integrations with third party systems. The following connectors are available when defining actions for alerting rules:
75+
76+
* [Cases](kibana://reference/connectors-kibana/cases-action-type.md)
77+
* [D3 Security](kibana://reference/connectors-kibana/d3security-action-type.md)
78+
* [Email](kibana://reference/connectors-kibana/email-action-type.md)
79+
* [{{ibm-r}}](kibana://reference/connectors-kibana/resilient-action-type.md)
80+
* [Index](kibana://reference/connectors-kibana/index-action-type.md)
81+
* [Jira](kibana://reference/connectors-kibana/jira-action-type.md)
82+
* [Microsoft Teams](kibana://reference/connectors-kibana/teams-action-type.md)
83+
* [Observability AI Assistant](kibana://reference/connectors-kibana/obs-ai-assistant-action-type.md)
84+
* [{{opsgenie}}](kibana://reference/connectors-kibana/opsgenie-action-type.md)
85+
* [PagerDuty](kibana://reference/connectors-kibana/pagerduty-action-type.md)
86+
* [Server log](kibana://reference/connectors-kibana/server-log-action-type.md)
87+
* [{{sn-itom}}](kibana://reference/connectors-kibana/servicenow-itom-action-type.md)
88+
* [{{sn-itsm}}](kibana://reference/connectors-kibana/servicenow-action-type.md)
89+
* [{{sn-sir}}](kibana://reference/connectors-kibana/servicenow-sir-action-type.md)
90+
* [Slack](kibana://reference/connectors-kibana/slack-action-type.md)
91+
* [{{swimlane}}](kibana://reference/connectors-kibana/swimlane-action-type.md)
92+
* [Torq](kibana://reference/connectors-kibana/torq-action-type.md)
93+
* [{{webhook}}](kibana://reference/connectors-kibana/webhook-action-type.md)
94+
* [xMatters](kibana://reference/connectors-kibana/xmatters-action-type.md)
95+
96+
::::{note}
97+
Some connector types are paid commercial features, while others are free. For a comparison of the Elastic subscription levels, go to [the subscription page](https://www.elastic.co/subscriptions).
98+
99+
::::
100+
101+
102+
For more information on creating connectors, refer to [Connectors](/deploy-manage/manage-connectors.md).
103+
104+
:::::
105+
106+
107+
:::::{dropdown} Action frequency
108+
After you select a connector, you must set the action frequency. You can choose to create a summary of alerts on each check interval or on a custom interval. Alternatively, you can set the action frequency such that you choose how often the action runs (for example, at each check interval, only when the alert status changes, or at a custom action interval). In this case, you must also select the specific threshold condition that affects when actions run: `Alert`, `No Data`, or `Recovered`.
109+
110+
:::{image} /solutions/images/serverless-custom-threshold-run-when.png
111+
:alt: Configure when a rule is triggered
112+
:screenshot:
113+
:::
114+
115+
You can also further refine the conditions under which actions run by specifying that actions only run when they match a KQL query or when an alert occurs within a specific time frame:
116+
117+
* **If alert matches query**: Enter a KQL query that defines field-value pairs or query conditions that must be met for notifications to send. The query only searches alert documents in the indices specified for the rule.
118+
* **If alert is generated during timeframe**: Set timeframe details. Notifications are only sent if alerts are generated within the timeframe you define.
119+
120+
:::{image} /solutions/images/serverless-logs-threshold-conditional-alert.png
121+
:alt: Configure a conditional alert
122+
:screenshot:
123+
:::
124+
125+
:::::
126+
127+
128+
:::::{dropdown} Action variables
129+
Use the default notification message or customize it. You can add more context to the message by clicking the Add variable icon ![Add variable](/solutions/images/serverless-indexOpen.svg "") and selecting from a list of available variables.
130+
131+
:::{image} /solutions/images/serverless-action-variables-popup.png
132+
:alt: Action variables list
133+
:screenshot:
134+
:::
135+
136+
The following variables are specific to this rule type. You can also specify [variables common to all rules](/explore-analyze/alerts-cases/alerts/rule-action-variables.md).
137+
138+
`context.alertDetailsUrl`
139+
: Link to the alert troubleshooting view for further context and details. This will be an empty string if the `server.publicBaseUrl` is not configured.
140+
141+
`context.cloud`
142+
: The cloud object defined by ECS if available in the source.
143+
144+
`context.container`
145+
: The container object defined by ECS if available in the source.
146+
147+
`context.group`
148+
: The array of objects containing groups that are reporting data.
149+
150+
`context.grouping` {applies_to}`stack: ga 9.1`
151+
: The object containing groups that are reporting data.
152+
153+
`context.host`
154+
: The host object defined by ECS if available in the source.
155+
156+
`context.labels`
157+
: List of labels associated with the entity where this alert triggered.
158+
159+
`context.orchestrator`
160+
: The orchestrator object defined by ECS if available in the source.
161+
162+
`context.reason`
163+
: A concise description of the reason for the alert.
164+
165+
`context.tags`
166+
: List of tags associated with the entity where this alert triggered.
167+
168+
`context.timestamp`
169+
: A timestamp of when the alert was detected.
170+
171+
`context.value`
172+
: List of the condition values.
173+
174+
`context.viewInAppUrl`
175+
: Link to the alert source.
176+
177+
:::::

solutions/toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ toc:
483483
- file: observability/incident-management/create-an-elasticsearch-query-rule.md
484484
- file: observability/incident-management/create-an-error-count-threshold-rule.md
485485
- file: observability/incident-management/create-failed-transaction-rate-threshold-rule.md
486+
- file: observability/incident-management/create-a-failed-docs-rule.md
486487
- file: observability/incident-management/create-an-inventory-rule.md
487488
- file: observability/incident-management/create-latency-threshold-rule.md
488489
- file: observability/incident-management/create-log-threshold-rule.md

0 commit comments

Comments
 (0)