Skip to content

Commit f379691

Browse files
committed
DOCS-4257: Document log alerting
1 parent b3a927d commit f379691

File tree

7 files changed

+94
-22
lines changed

7 files changed

+94
-22
lines changed
-17.6 KB
Binary file not shown.
-19.3 KB
Binary file not shown.
-117 KB
Binary file not shown.

docs/data-ai/ai/alert.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,12 @@ Follow these steps to configure a trigger to alert when `filtered-camera` syncs
168168

169169
1. Click **Add Email**.
170170

171-
{{<imgproc src="/build/configure/trigger-configured-email.png" resize="x600" style="width: 500px" declaredimensions=true alt="The trigger configured with an example email address." class="shadow imgzoom" >}}
172-
173171
1. Add the email address you wish to be notified whenever this trigger fires.
174172

175173
To add a webhook notification:
176174

177175
1. Click **Add Webhook**.
178176

179-
{{<imgproc src="/build/configure/trigger-configured.png" resize="x600" style="width: 500px" declaredimensions=true alt="The trigger configured with an example webhook URL." class="shadow imgzoom" >}}
180-
181177
1. Add the URL of your cloud function.
182178
1. Write your cloud function to process the [webhook data](/data-ai/reference/triggers-configuration/#webhook-attributes).
183179
Use your cloud function to process data or interact with external APIs, such as Twilio, PagerDuty, or Zapier.

docs/data-ai/data/alert-data.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ You can configure triggers to fire in the following scenarios:
2626
1. Go to the **CONFIGURE** tab of your machine.
2727
Click the **+** (Create) button in the left side menu and select **Trigger**.
2828

29-
{{<imgproc src="/build/configure/trigger-create.png" resize="x800" declaredimensions=true alt="The Create menu with Trigger at the bottom of the list of options." style="width: 400px" class="shadow imgzoom" >}}
30-
3129
1. Enter a name and click **Create**.
3230

3331
1. In the **Type** dropdown, choose one of the following event types:
@@ -57,7 +55,6 @@ You can configure triggers to fire in the following scenarios:
5755
To add a webhook:
5856

5957
1. Click **Add Webhook**.
60-
{{<imgproc src="/build/configure/trigger-configured.png" resize="x800" style="width: 500px" declaredimensions=true alt="A trigger configured with an example URL." class="shadow imgzoom" >}}
6158
1. Add the URL of your cloud function.
6259
1. Configure the time between notifications.
6360
1. Write your cloud function to process the [webhook](/data-ai/reference/triggers-configuration/#webhook-attributes).
@@ -67,7 +64,6 @@ You can configure triggers to fire in the following scenarios:
6764
To add an email notification:
6865

6966
1. Click **Add Email**.
70-
{{<imgproc src="/build/configure/trigger-configured-email.png" resize="x800" style="width: 500px" declaredimensions=true alt="A trigger configured with an example email." class="shadow imgzoom" >}}
7167
1. Add the email address where you wish to be notified whenever this trigger fires.
7268
1. Configure the time between notifications.
7369

docs/data-ai/reference/triggers-configuration.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ Triggers can alert you by email or webhook when any of the following events occu
1414
- [machine telemetry data syncs from your local device to the Viam cloud](/manage/troubleshoot/alert/)
1515
- [data syncs from a machine](/data-ai/data/alert-data/)
1616
- [service detects a specified object or classifies a specified label](/data-ai/ai/alert/)
17+
- [machine logs contain errors, warnings, or info logs](/manage/troubleshoot/alert/)
1718

1819
This page provides a reference for the Trigger attributes.
19-
For step-by-step configuration information, see the links above instead.
20+
For step-by-step configuration information, see the preceding links instead.
2021

2122
## JSON configuration templates
2223

@@ -100,6 +101,30 @@ The following template demonstrates the structure of a JSON configuration for a
100101
]
101102
```
102103

104+
### Machine logs trigger template
105+
106+
```json {class="line-numbers linkable-line-numbers"}
107+
"triggers": [
108+
{
109+
"name": "<trigger name>",
110+
"event": {
111+
"type": "conditional_logs_ingested",
112+
"log_levels": [
113+
"error",
114+
"warn",
115+
"info"
116+
]
117+
},
118+
"notifications": [
119+
{
120+
"type": "<webhook|email>",
121+
"value": "<webhook URL or email address>"
122+
}
123+
]
124+
}
125+
]
126+
```
127+
103128
## Trigger attributes
104129

105130
Triggers support the following attributes:
@@ -108,8 +133,8 @@ Triggers support the following attributes:
108133
| Name | Type | Required? | Description |
109134
| ---- | ---- | --------- | ----------- |
110135
| `name` | string | **Required** | The name of the trigger |
111-
| `event` | object | **Required** | The trigger event object, which contains the following fields: <ul><li>`type`: The type of the event to trigger on. Options: <ul><li>`part_data_ingested`: fire when data syncs</li> <li>`conditional_data_ingested`: fire when data that meets a certain condition syncs</li> <li>`part_online`: fire when the part is online</li> <li>`part_offline`: fire when the part is offline</li></ul></li><li>`data_types`: Required with `type` `part_data_ingested`. An array of data types that trigger the event. Options: `binary`, `tabular`, `file`, `unspecified`. </li><li> `conditional`: Required when `type` is `conditional_data_ingested`. For more information about this field, see [Conditional attributes](/data-ai/reference/triggers-configuration/#conditional-attributes). </li></ul> |
112-
| `notifications` | object | **Required** | The notifications object, which contains the following fields: <ul><li>`type`: The type of the notification. Options: `webhook`, `email`</li><li>`value`: The URL to send the request to or the email address to notify.</li><li>`seconds_between_notifications`: The interval between notifications in seconds.</li></ul> For more information on webhooks, see [Webhook attributes](#webhook-attributes). |
136+
| `event` | object | **Required** | The trigger event object, which contains the following fields: <ul><li>`type`: The type of the event to trigger on. Options: <ul><li>`part_data_ingested`: fire when data syncs</li> <li>`conditional_data_ingested`: fire when data that meets a certain condition syncs</li> <li>`part_online`: fire when the part is online</li> <li>`part_offline`: fire when the part is offline</li> <li>`conditional_logs_ingested`: check every hour and fire if logs of the specified log level are present</li></ul></li><li>`data_types`: Required with `type` `part_data_ingested`. An array of data types that trigger the event. Options: `binary`, `tabular`, `file`, `unspecified`. </li><li> `conditional`: Required when `type` is `conditional_data_ingested`. For more information about this field, see [Conditional attributes](/data-ai/reference/triggers-configuration/#conditional-attributes). </li><li> `log_levels`: Required when `type` is `conditional_logs_ingested`. An array of log levels. Options: `error`, `warn`, `info`. </li></ul> |
137+
| `notifications` | object | **Required** | The notifications object, which contains the following fields: <ul><li>`type`: The type of the notification. Options: `webhook`, `email`</li><li>`value`: The URL to send the request to or the email address to notify.</li><li>`seconds_between_notifications`: The interval between notifications in seconds. This field is ignored for event type `conditional_logs_ingested` where the interval is always one hour.</li></ul> For more information on webhooks, see [Webhook attributes](#webhook-attributes). |
113138
| `notes` | string | Optional | Descriptive text to document the purpose, configuration details, or other important information about this trigger. |
114139

115140
## Conditional attributes

docs/manage/troubleshoot/alert.md

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ date: "2024-12-07"
2323
cost: "0"
2424
---
2525

26-
You can configure triggers that alert you when machine telemetry data syncs from your local device to the Viam cloud:
26+
You can configure triggers that alert you when machine telemetry data syncs from your local device to the Viam cloud or based on log messages:
2727

2828
- **Telemetry sync**: Alerts whenever certain telemetry syncs
2929
- **Conditional telemetry sync**: Alert only when synced telemetry satisfies a condition
30+
- **Logs**: Alert on error, warning, or info logs appearing on a machine
3031

3132
For example, you can configure a trigger to send you a notification when your machine's CPU usage reaches a certain threshold.
3233

@@ -201,8 +202,6 @@ Use **Builder mode** to create a trigger:
201202
Go to the **CONFIGURE** tab of your machine.
202203
Click the **+** (Create) button in the left side menu and select **Trigger**.
203204

204-
{{<imgproc src="/build/configure/trigger-create.png" resize="x400" declaredimensions=true alt="The Create menu with Trigger at the bottom of the list of options.">}}
205-
206205
{{< /tablestep >}}
207206
{{< tablestep >}}
208207
**Create the trigger**
@@ -245,14 +244,12 @@ To add a notification method, add an entry to the **Webhooks** or **Email** sub-
245244
To add an email notification:
246245

247246
1. Click **Add Email**.
248-
{{<imgproc src="/build/configure/trigger-configured-email.png" resize="x400" style="width: 500px" declaredimensions=true alt="The trigger configured with an example email." class="shadow" >}}
249247
1. Add the email you wish to be notified whenever this trigger is triggered.
250248
1. Configure the time between notifications.
251249

252250
To add a webhook notification:
253251

254252
1. Click **Add Webhook**.
255-
{{<imgproc src="/build/configure/trigger-configured.png" resize="x400" style="width: 500px" declaredimensions=true alt="The trigger configured with an example URL." class="shadow" >}}
256253
1. Add the URL of your cloud function.
257254
1. Configure the time between notifications.
258255
1. Write your cloud function to process the [webhook](/data-ai/reference/triggers-configuration/#webhook-attributes).
@@ -338,6 +335,70 @@ In the **Data capture** section of your sensor's configuration, toggle the switc
338335

339336
Click the **Save** button in the top right corner of the page to save your configuration.
340337

338+
## Alert on machine logs
339+
340+
{{< tabs >}}
341+
{{% tab name="Builder mode" %}}
342+
343+
1. Go to the **CONFIGURE** tab of your machine.
344+
Click the **+** (Create) button in the left side menu and select **Trigger**.
345+
346+
1. Name the trigger and click **Create**.
347+
348+
1. Select **Conditional logs ingestion** as the trigger **Type**.
349+
350+
1. Select any number of log levels (**Error**, **Warn**, and **Info**) to alert on.
351+
352+
**Once per hour**, Viam issues an alert if maching logs are found.
353+
354+
1. To add a notification method, add an entry to the **Webhooks** or **Email** sub-panels:
355+
356+
To add an email notification:
357+
358+
1. Click **Add Email**.
359+
1. Add the email you wish to be notified whenever this trigger is triggered.
360+
1. Configure the time between notifications.
361+
362+
To add a webhook notification:
363+
364+
1. Click **Add Webhook**.
365+
1. Add the URL of your cloud function.
366+
1. Configure the time between notifications.
367+
1. Write your cloud function to process the [webhook attributes](/data-ai/reference/triggers-configuration/#webhook-attributes).
368+
Use your cloud function to process data or interact with any external API, including Twilio, PagerDuty, or Zapier.
369+
370+
{{% /tab %}}
371+
{{% tab name="JSON mode" %}}
372+
373+
Use the following template in your `components` JSON to configure the top-level `triggers` field:
374+
375+
```json {class="line-numbers linkable-line-numbers"}
376+
"triggers": [
377+
{
378+
"name": "<trigger name>",
379+
"event": {
380+
"type": "conditional_logs_ingested",
381+
"log_levels": [
382+
"error",
383+
"warn",
384+
"info"
385+
]
386+
},
387+
"notifications": [
388+
{
389+
"type": "<webhook|email>",
390+
"value": "<webhook URL or email address>"
391+
}
392+
]
393+
}
394+
]
395+
```
396+
397+
{{% /tab %}}
398+
{{< /tabs >}}
399+
400+
For more information about triggers, see [Trigger configuration](/data-ai/reference/triggers-configuration/).
401+
341402
## Alert on machine status
342403

343404
### Part is online
@@ -348,8 +409,6 @@ Click the **Save** button in the top right corner of the page to save your confi
348409
1. Go to the **CONFIGURE** tab of your machine.
349410
Click the **+** (Create) button in the left side menu and select **Trigger**.
350411

351-
{{<imgproc src="/build/configure/trigger-create.png" resize="x400" declaredimensions=true alt="The Create menu with Trigger at the bottom of the list of options." class="shadow">}}
352-
353412
2. Name the trigger and click **Create**.
354413

355414
3. Select **Part is online** as the trigger **Type**.
@@ -359,14 +418,12 @@ Click the **Save** button in the top right corner of the page to save your confi
359418
To add an email notification:
360419

361420
1. Click **Add Email**.
362-
{{<imgproc src="/build/configure/trigger-configured-email.png" resize="x400" style="width: 500px" declaredimensions=true alt="The trigger configured with an example email." class="shadow" >}}
363421
1. Add the email you wish to be notified whenever this trigger is triggered.
364422
1. Configure the time between notifications.
365423

366424
To add a webhook notification:
367425

368426
1. Click **Add Webhook**.
369-
{{<imgproc src="/build/configure/trigger-configured.png" resize="x400" style="width: 500px" declaredimensions=true alt="The trigger configured with an example URL." class="shadow" >}}
370427
1. Add the URL of your cloud function.
371428
1. Configure the time between notifications.
372429
1. Write your cloud function to process the [webhook attributes](/data-ai/reference/triggers-configuration/#webhook-attributes).
@@ -408,8 +465,6 @@ For more information about triggers, see [Trigger configuration](/data-ai/refere
408465
1. Go to the **CONFIGURE** tab of your machine.
409466
Click the **+** (Create) button in the left side menu and select **Trigger**.
410467

411-
{{<imgproc src="/build/configure/trigger-create.png" resize="x400" declaredimensions=true alt="The Create menu with Trigger at the bottom of the list of options." class="shadow">}}
412-
413468
2. Name the trigger and click **Create**.
414469

415470
3. Select **Part is offline** as the trigger **Type**.

0 commit comments

Comments
 (0)