You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: explore-analyze/alerts-cases/watcher.md
+1-15Lines changed: 1 addition & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ mapped_urls:
10
10
# Watcher
11
11
12
12
::::{tip}
13
-
{{kib}} Alerting provides a set of built-in actions and alerts that are integrated with applications such as APM, Metrics, Security, and Uptime. You can use {{kib}} Alerting to detect complex conditions within different {{kib}} apps and trigger actions when those conditions are met. For more information, see [Alerting and actions](../alerts-cases.md).
13
+
{{kib}} Alerting provides a set of built-in actions and alerts that are integrated with applications such as APM, Metrics, Security, and Uptime. You can use {{kib}} Alerting to detect complex conditions within different {{kib}} apps and trigger actions when those conditions are met. For more information, refer to [Alerts and Cases](../alerts-cases.md).
14
14
::::
15
15
16
16
You can use Watcher to watch for changes or anomalies in your data and perform the necessary actions in response. For example, you might want to:
@@ -46,17 +46,3 @@ Actions
46
46
: One or more actions, such as sending email, pushing data to 3rd party systems through a webhook, or indexing the results of the query.
47
47
48
48
A full history of all watches is maintained in an Elasticsearch index. This history keeps track of each time a watch is triggered and records the results from the query, whether the condition was met, and what actions were taken.
49
-
50
-
% Internal links rely on the following IDs being on this page (e.g. as a heading ID, paragraph ID, etc):
Copy file name to clipboardExpand all lines: explore-analyze/alerts-cases/watcher/enable-watcher.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,9 @@
1
1
# Enable Watcher [enable-watcher]
2
2
3
3
::::{note}
4
-
If you are looking for Kibana alerting, check [Alerting and Actions](../../../explore-analyze/alerts-cases.md) in the Kibana Guide.
4
+
If you are looking for Kibana alerting, check [Alerts and Cases](../../../explore-analyze/alerts-cases.md).
5
5
::::
6
6
7
-
Watcher lets you take action based on changes in your data. It is designed around the principle that, if you can query something in Elasticsearch, you can alert on it. Simply define a query, condition, schedule, the actions to take, and Watcher will do the rest.
8
-
9
7
Watcher can be enabled when configuring your cluster. You can run Alerting on a separate cluster from the cluster whose data you are actually watching.
10
8
11
9
## Before you begin [watcher-before-you-begin]
@@ -20,7 +18,7 @@ To learn more about Kibana alerting and how to use it, check [Alerting and Actio
20
18
21
19
## Send alerts by email [watcher-allowlist]
22
20
23
-
Alerting can send alerts by email. You can configure notifications similar to the [operational emails](../../../deploy-manage/cloud-organization/operational-emails.md) that Elasticsearch Service sends automatically to alert you about performance issues in your clusters.
21
+
You can configure notifications similar to the [operational emails](../../../deploy-manage/cloud-organization/operational-emails.md) that Elasticsearch Service sends automatically to alert you about performance issues in your clusters.
24
22
25
23
Watcher in Elastic Cloud is preconfigured with an email service and can be used without any additional configuration. Alternatively, a custom mail server can be configured as described in [Configuring a custom mail server](../../../explore-analyze/alerts-cases/watcher.md#ec-watcher-custom-mail-server)
Copy file name to clipboardExpand all lines: explore-analyze/alerts-cases/watcher/encrypting-data.md
+4-7Lines changed: 4 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,9 @@ To encrypt sensitive data in {{watcher}}:
13
13
14
14
1. Use the [elasticsearch-syskeygen](https://www.elastic.co/guide/en/elasticsearch/reference/current/syskeygen.html) command to create a system key file.
15
15
2. Copy the `system_key` file to all of the nodes in your cluster.
16
-
17
-
::::{important}
18
-
The system key is a symmetric key, so the same key must be used on every node in the cluster.
19
-
::::
16
+
::::{important}
17
+
The system key is a symmetric key, so the same key must be used on every node in the cluster.
18
+
::::
20
19
21
20
3. Set the [`xpack.watcher.encrypt_sensitive_data` setting](https://www.elastic.co/guide/en/elasticsearch/reference/current/notification-settings.html):
22
21
@@ -34,8 +33,6 @@ To encrypt sensitive data in {{watcher}}:
34
33
35
34
5. Delete the `system_key` file on each node in the cluster.
36
35
37
-
::::{note}
36
+
::::{note}
38
37
Existing watches are not affected by these changes. Only watches that you create after following these steps have encryption enabled.
Use the `chain` input to load data from multiple sources into the watch execution context when the watch is triggered. The inputs in a chain are processed in order and the data loaded by an input can be accessed by the subsequent inputs in the chain.
13
10
14
11
The `chain` input enables you to perform actions based on data from multiple sources. You can also use the data collected by one input to load data from another source.
@@ -43,12 +40,10 @@ For example, the following chain input loads data from an HTTP server using the
43
40
1. The inputs in a chain are specified as an array to guarantee the order in which the inputs are processed. (JSON does not guarantee the order of arbitrary objects.)
44
41
2. Loads the `path` set by the `first` input.
45
42
46
-
47
43
## Accessing chained input data [_accessing_chained_input_data]
48
44
49
45
To reference data loaded by a particular input, you use the input’s name, `ctx.payload.<input-name>.<value>`.
50
46
51
-
52
47
## Transforming chained input data [_transforming_chained_input_data]
53
48
54
49
In certain use-cases the output of the first input should be used as input in a subsequent input. This requires you to do a transform, before you pass the data on to the next input.
Use the `http` input to submit a request to an HTTP endpoint and load the response into the watch execution context when the watch is triggered. See [HTTP input attributes](#http-input-attributes) for all of the supported attributes.
13
10
14
11
With the `http` input, you can:
@@ -48,7 +45,6 @@ You can use the full Elasticsearch [Query DSL](../../query-filter/languages/quer
To load the data from other Elasticsearch APIs, specify the API endpoint as the `path` attribute. Use the `params` attribute to specify query string parameters. For example, the following `http` input calls the [cluster stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-stats.html) API and enables the `human` attribute:
@@ -70,8 +66,6 @@ To load the data from other Elasticsearch APIs, specify the API endpoint as the
70
66
71
67
1. Enabling this attribute returns the `bytes` values in the response in human readable format.
72
68
73
-
74
-
75
69
## Calling external web services [input-http-auth-basic-example]
76
70
77
71
You can use `http` input to get data from any external web service. The `http` input supports basic authentication. For example, the following input provides a username and password to access `myservice`:
@@ -131,8 +125,6 @@ You can also call an API using a `Bearer token` instead of basic authentication.
131
125
}
132
126
```
133
127
134
-
135
-
136
128
## Using templates [_using_templates_2]
137
129
138
130
The `http` input supports templating. You can use [templates](how-watcher-works.md#templates) when specifying the `path`, `body`, header values, and parameter values.
@@ -152,7 +144,6 @@ For example, the following snippet uses templates to specify what index to query
152
144
}
153
145
```
154
146
155
-
156
147
## Accessing the HTTP response [_accessing_the_http_response]
157
148
158
149
If the response body is formatted in JSON or YAML, it is parsed and loaded into the execution context. If the response body is not formatted in JSON or YAML, it is loaded into the payload’s `_value` field.
@@ -161,7 +152,6 @@ Conditions, transforms, and actions access the response data through the executi
161
152
162
153
In addition all the headers from the response can be accessed using the `ctx.payload._headers` field as well as the HTTP status code of the response using `ctx.payload._status_code`.
163
154
164
-
165
155
## HTTP input attributes [http-input-attributes]
166
156
167
157
| Name | Required | Default | Description |
@@ -193,5 +183,3 @@ You can reference the following variables in the execution context when specifyi
193
183
|`ctx.trigger.triggered_time`| The time this watch was triggered. |
194
184
|`ctx.trigger.scheduled_time`| The time this watch was supposed to be triggered. |
195
185
|`ctx.metadata.*`| Any metadata associated with the watch. |
Use the `search` input to load the results of an Elasticsearch search request into the execution context when the watch is triggered. See [Search Input Attributes](#search-input-attributes) for all of the supported attributes.
13
10
14
11
In the search input’s `request` object, you specify:
@@ -74,7 +71,6 @@ For example, the following input loads only the total number of hits into the wa
74
71
},
75
72
```
76
73
77
-
78
74
## Using Templates [_using_templates]
79
75
80
76
The `search` input supports [search templates](../../../solutions/search/search-templates.md). For example, the following snippet references the indexed template called `my_template` and passes a value of 23 to fill in the template’s `value` parameter:
@@ -98,7 +94,6 @@ The `search` input supports [search templates](../../../solutions/search/search-
98
94
}
99
95
```
100
96
101
-
102
97
## Applying conditions [_applying_conditions]
103
98
104
99
The `search` input is often used in conjunction with the [`script`](condition-script.md) condition. For example, the following snippet adds a condition to check if the search returned more than five hits:
@@ -122,7 +117,6 @@ The `search` input is often used in conjunction with the [`script`](condition-sc
122
117
}
123
118
```
124
119
125
-
126
120
## Accessing the search results [_accessing_the_search_results]
127
121
128
122
Conditions, transforms, and actions can access the search results through the watch execution context. For example:
@@ -132,12 +126,10 @@ Conditions, transforms, and actions can access the search results through the wa
132
126
* To access a particular hit, use its zero-based array index. For example, to get the third hit, use `ctx.payload.hits.hits.2`.
133
127
* To get a field value from a particular hit, use `ctx.payload.hits.hits.<index>.fields.<fieldname>`. For example, to get the message field from the first hit, use `ctx.payload.hits.hits.0.fields.message`.
134
128
135
-
::::{note}
129
+
::::{note}
136
130
The total number of hits in the search response is returned as an object in the response. It contains a `value`, the number of hits, and a `relation` that indicates if the value is accurate (`"eq"`) or a lower bound of the total hits that match the query (`"gte"`). You can set `track_total_hits` to true in the search request to tell Elasticsearch to always track the number of hits accurately.
Use the `simple` input to load static data into the execution context when the watch is triggered. This enables you to store the data centrally and reference it with templates.
13
10
14
11
You can define the static data as a string (`str`), numeric value (`num`), or an object (`obj`):
@@ -50,4 +47,3 @@ For example, the following watch uses the `simple` input to set the recipient na
When a watch is triggered, its *input* loads data into the execution context. This payload is accessible during the subsequent watch execution phases. For example, you can base a watch’s condition on the data loaded by its input.
13
10
14
11
{{watcher}} supports four input types:
@@ -18,12 +15,6 @@ When a watch is triggered, its *input* loads data into the execution context. Th
18
15
*[`http`](input-http.md): load the results of an HTTP request into the execution context.
19
16
*[`chain`](input-chain.md): use a series of inputs to load data into the execution context.
20
17
21
-
::::{note}
18
+
::::{note}
22
19
If you don’t define an input for a watch, an empty payload is loaded into the execution context.
Copy file name to clipboardExpand all lines: explore-analyze/alerts-cases/watcher/watcher-getting-started.md
+6-15Lines changed: 6 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,13 @@ mapped_pages:
5
5
6
6
# Getting started with Watcher [watcher-getting-started]
7
7
8
-
$$$watch-log-data$$$
9
8
To set up a watch to start sending alerts:
10
9
11
10
*[Schedule the watch and define an input](#log-add-input).
12
11
*[Add a condition](#log-add-condition) that checks to see if an alert needs to be sent.
13
12
*[Configure an action](#log-take-action) to send an alert when the condition is met.
14
13
15
-
16
-
## Schedule the watch and define an input [log-add-input]
14
+
## Schedule the watch and define an input [log-add-input]
17
15
18
16
A watch [schedule](trigger-schedule.md) controls how often a watch is triggered. The watch [input](input.md) gets the data that you want to evaluate.
19
17
@@ -56,8 +54,7 @@ GET .watcher-history*/_search?pretty
56
54
}
57
55
```
58
56
59
-
60
-
## Add a condition [log-add-condition]
57
+
## Add a condition [log-add-condition]
61
58
62
59
A [condition](condition.md) evaluates the data you’ve loaded into the watch and determines if any action is required. Now that you’ve loaded log errors into the watch, you can define a condition that checks to see if any errors were found.
63
60
@@ -87,7 +84,6 @@ PUT _watcher/watch/log_error_watch
87
84
88
85
1. The [compare](condition-compare.md) condition lets you easily compare against values in the execution context.
89
86
90
-
91
87
For this compare condition to evaluate to `true`, you need to add an event to the `logs` index that contains an error. For example, the following request adds a 404 error to the `logs` index:
92
88
93
89
```console
@@ -116,8 +112,7 @@ GET .watcher-history*/_search?pretty
116
112
}
117
113
```
118
114
119
-
120
-
## Configure an action [log-take-action]
115
+
## Configure an action [log-take-action]
121
116
122
117
Recording watch records in the watch history is nice, but the real power of {{watcher}} is being able to do something when the watch condition is met. A watch’s [actions](actions.md) define what to do when the watch condition evaluates to `true`. You can send emails, call third-party webhooks, write documents to an Elasticsearch index, or log messages to the standard Elasticsearch log files.
123
118
@@ -152,8 +147,7 @@ PUT _watcher/watch/log_error_watch
152
147
}
153
148
```
154
149
155
-
156
-
## Delete the Watch [log-delete]
150
+
## Delete the Watch [log-delete]
157
151
158
152
Since the `log_error_watch` is configured to run every 10 seconds, make sure you delete it when you’re done experimenting. Otherwise, the noise from this sample watch will make it hard to see what else is going on in your watch history and log file.
159
153
@@ -163,17 +157,14 @@ To remove the watch, use the [delete watch API](https://www.elastic.co/guide/en/
To enable users to create and manipulate watches, assign them the `watcher_admin` security role. Watcher admins can also view watches, watch history, and triggered watches.
170
163
171
164
To allow users to view watches and the watch history, assign them the `watcher_user` security role. Watcher users cannot create or manipulate watches; they are only allowed to execute read-only watch operations.
172
165
173
-
174
-
## Where to go next [next-steps]
166
+
## Where to go next [next-steps]
175
167
176
168
* See [*How {{watcher}} works*](how-watcher-works.md) for more information about the anatomy of a watch and the watch lifecycle.
177
169
* See [*Example watches*](example-watches.md) for more examples of setting up a watch.
178
170
* See the [Example Watches](https://github.com/elastic/examples/tree/master/Alerting) in the Elastic Examples repo for additional sample watches you can use as a starting point for building custom watches.
Copy file name to clipboardExpand all lines: explore-analyze/alerts-cases/watcher/watcher-ui.md
+7-9Lines changed: 7 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,18 @@
1
1
# Watcher UI [watcher-ui]
2
2
3
-
Watcher is an {{es}} feature that you can use to create actions based on conditions, which are periodically evaluated using queries on your data. Watches are helpful for analyzing mission-critical and business-critical streaming data. For example, you might watch application logs for performance outages or audit access logs for security threats.
4
-
5
3
Go to the **Watcher** page using the navigation menu or the [global search field](/explore-analyze/find-and-organize/find-apps-and-objects.md). With this UI, you can:
6
4
7
-
*[Create a simple threshold watch](../../../explore-analyze/alerts-cases/watcher.md#watcher-create-threshold-alert)
8
-
*[View your watch history and action status](../../../explore-analyze/alerts-cases/watcher.md#watcher-getting-started)
9
-
*[Deactivate and delete a watch](../../../explore-analyze/alerts-cases/watcher.md#watcher-deactivate)
10
-
*[Create an advanced watch using API syntax](../../../explore-analyze/alerts-cases/watcher.md#watcher-create-advanced-watch)
5
+
*[Create a simple threshold watch](#watcher-create-threshold-alert)
6
+
*[View your watch history and action status](#watcher-getting-started)
7
+
*[Deactivate and delete a watch](#watcher-deactivate)
8
+
*[Create an advanced watch using API syntax](#watcher-create-advanced-watch)
[Alerting on cluster and index events](../../../explore-analyze/alerts-cases/watcher.md) is a good source for detailed information on how watches work. If you are using the UI to create a threshold watch, take a look at the different watcher actions. If you are creating an advanced watch, you should be familiar with the parts of a watch—input, schedule, condition, and actions.
15
13
16
14
::::{note}
17
-
There are limitations in **Watcher** that affect {{kib}}. For information, refer to [Alerting](../../../explore-analyze/alerts-cases/watcher/watcher-limitations.md).
15
+
There are limitations in **Watcher** that affect {{kib}}. For information, refer to [Limitations](watcher-limitations.md).
18
16
::::
19
17
20
18
## Watcher security [watcher-security]
@@ -146,5 +144,5 @@ After starting the simulation, you’ll see a results screen. For more informati
146
144
147
145
Refer to these examples for creating an advanced watch:
148
146
149
-
*[Watch the status of an {{es}} cluster](../../../explore-analyze/alerts-cases/watcher/watch-cluster-status.md)
0 commit comments