# Alarms

Alarms for Error Logs is now available for all accounts. You can create and manage Alarms from the Monitor tab in the [Twilio Console](https://console.twilio.com/). This enhanced monitoring proactively notifies you when spikes in errors occur.

![Red error indicator next to the Monitor tab in Twilio Console sidebar.](https://docs-resources.prod.twilio.com/1d0a4a0665ce729a87b8dc52ccb6341cd9bc714629bec37e56d2598ed9faf2f8.png)

## Getting Started

There are multiple ways to create an Alarm:

* Directly from the [Manage Alarms](https://console.twilio.com/any/monitor/alarms/manage) page.
* From the [Error Logs](https://console.twilio.com/any/monitor/logs/debugger/errors) view, click +**Create Alarm**.

  ![Menu with options to create alarm or inspect for a Twilio error event.](https://docs-resources.prod.twilio.com/5ff3ecab3582f9b42b24af8e91819098b297122db6462801d981f4e1df6bfa20.png)
* From the Error Logs view, click the **three dots** next to an Error and select **Create alarm**.

  ![Demonstration of clicking the three dots menu for an error and accessing the Create alarm option.](https://docs-resources.prod.twilio.com/a3595b6bec5aad5f73a49cc496931c6a0506a43b38e83ebb847f450bb12ab89a.png)

After taking any of these actions, you'll be taken to the [Create Alarm page](https://console.twilio.com/any/monitor/alarms/create). This page allows you to configure your Alarm properties:

* The error you are monitoring for.
* The threshold and period you want to check against.
* Who gets notified when the Alarm is triggered, and how will they be notified.

> \[!WARNING]
>
> Alarms are Account-specific and will not aggregate from sub-Accounts up to Parent accounts.

## Configure an Alarm

There are 4 main steps to set up an Alarm.

### 1. Select an Error Code to monitor

The first step is to select an Error Code from the **Error code** dropdown. You can configure the Alarm to monitor for a specific Error Code or for **any** error occurrence. The error code selection dropdown is searchable as well.

> \[!NOTE]
>
> For your reference, all of Twilio's Error Codes, with possible causes and solutions, are documented [here](/docs/api/errors).

> \[!NOTE]
>
> Creating an Alarm from an individual error event will automatically populate the **Error code** field with that Error Code for you.

Once you select an Error Code, the page will display a graph showing a visual timeline of the selected error's rate of occurrence.

![Error trend graph for code 82002 on Twilio Function response over 30 days.](https://docs-resources.prod.twilio.com/a83c945274e8d6996b02bcc842032919c2ee1fa2d80ff46560504eb98e6c2096.png)

### 2. Define the Alarm's threshold and period

The Alarm will be triggered when the selected Error exceeds your defined Alarm threshold within the selected Time period. You can choose from the following time boxes to allow for near real-time alerting: 5 minutes, 15 minutes, 1 hour, 12 hours, and 24 hours.

![Alarm threshold set to 1 and time period set to every 5 minutes.](https://docs-resources.prod.twilio.com/4adb1c08082c6da5503e7b0c64801a1e5ee67f057b681ac87a14069f270fdf6c.png)

### 3. Configure notification preferences

The notification preferences enable you to be notified in-console, via email, or webhook. You may select any combination of these options. Provide any necessary email addresses and/or a webhook URL if you enable either of those notification types.

If you enable the webhook option, the provided URL will receive a request with a set of key-value pairs that describe the alarm. These keys are [documented below](#alarms-webhook-payload-data).

![Notification configuration options with console, email, and webhook settings enabled.](https://docs-resources.prod.twilio.com/a7a8535f22d2325ccb6397eb14f23ed1e5489143930fb1157ca7a535f86dac36.png)

The in-console notification is a red indicator displayed as a badge on the Monitoring tab.

![Example of the red error indicator in the Twilio Console, next to the Monitor tab.](https://docs-resources.prod.twilio.com/16cb4145c5837eb72f64e9eb275c325c82835ee349fae10e60ce46b57c31d047.png)

> \[!NOTE]
>
> Alarm notifications will be triggered within 15 seconds of exceeding the defined threshold.

### 4. Name your Alarm

Finally, give your Alarm a friendly name and click **Save** to activate the Alarm.

The Alarm can now be maintained from the Manage alarms page.

![Alarm naming step with input 'Functions Alarm with Webhook' and save or delete options.](https://docs-resources.prod.twilio.com/8a7fc0d438038d1824f1ee21d76e43db3ec363cfff9dfab7686ab83b23d05d3d.png)

## Manage Alarms

You can duplicate, delete, or edit any Alarm from the Manage alarms page.

Click the name of an Alarm to perform any edits, or click the **three dots** to display options to duplicate or delete the Alarm.

![Manage alarms page showing Twilio Errors, 14239 Error Code, and Any Twilio Errors with timestamps.](https://docs-resources.prod.twilio.com/90ae9c0e9af6958777cf7d210512f295140034e5292aa3aebbf921ceb3f799f9.png)

## Alarms History

The Alarms history page shows a list of all triggered Alarms within your account. The Alarms history does **not** aggregate Alarms from subaccounts. Each account's Alarms are independent.

Clicking on an Alarm occurrence will take you to the Alarm History detail page, which provides additional information about when the Alarm was triggered and troubleshooting steps for the Error that occurred.

Email notifications will contain a link to the Alarm History detail page so that you can access that information quickly and directly.

![Alarms history page showing list of alarms with names, product, threshold, and timestamps.](https://docs-resources.prod.twilio.com/0a093cd969d522c28a137b80809a9a0549de53003577ecf05dacd206a8098581.png)

## Alarms webhook payload data

If you provide a webhook URL to an Alarm to [receive notifications](#3-configure-notification-preferences), Twilio will make a `POST` request to your URL with the following keys as query parameters, similar to [all other Twilio Webhook requests](/docs/messaging/guides/webhook-request):

| **Parameter**        | **Description**                                                                                                                                                                                                            | **Example**                                                                     |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| AccountSid           | The 34-character ID of the Account this alarm is associated with.                                                                                                                                                          | `"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"`                                          |
| AppMonitorTriggerSid | The 34-character ID of the Alarm that was triggered                                                                                                                                                                        | `"AKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"`                                          |
| CurrentValue         | The current error count for the defined `TimePeriod` that the Alarm is monitoring                                                                                                                                          | `2`                                                                             |
| DateFired            | When this notification was triggered, in UTC                                                                                                                                                                               | `"Tue, 09 08 2022 16:51:20 +0000"`                                              |
| Description          | A description of the error the Alarm was monitoring                                                                                                                                                                        | `"Any Warning or Error"`                                                        |
| ErrorCode            | A unique error code for the error condition. You can look up errors, with possible causes and solutions, in our [Error Dictionary](/docs/api/errors).                                                                      | `10004`                                                                         |
| IdempotencyToken     | A random token generated by Twilio, and guaranteed to be unique for this particular firing of this Alarm. This is [idempotent](https://en.wikipedia.org/wiki/Idempotence).                                                 | `"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-FIRES-AKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"` |
| Log                  | The log level. Can be: `error` or `warning`.                                                                                                                                                                               | `"error"`                                                                       |
| TimePeriod           | The period over which the Alarm counts errors, one of `FIVE_MINS`, `FIFTEEN_MINS`, `ONE_HOUR`, `TWELVE_HOURS`, or `ONE_DAY`. For instance, a daily `TimePeriod` would reset the error count every day. Periods are in UTC. | `"ONE_DAY"`                                                                     |
| TriggerValue         | The error count at which the Alarm fires.                                                                                                                                                                                  | `1.000000`                                                                      |

### Webhook payload example

The following example shows a webhook request body that contains an alarm notification:

```json
{
  "AccountSid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "AppMonitorTriggerSid": "AKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "CurrentValue": "2",
  "DateFired": "Tue, 09 08 2022 16:51:20 +0000",
  "Description": "Any Warning or Error",
  "ErrorCode": "10004",
  "IdempotencyToken": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-FIRES-AKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "Log": "error",
  "TimePeriod": "ONE_DAY",
  "TriggerValue": "1.000000"
}
```

We'd love to hear your thoughts about this product—please reach out to our support team if you have any questions, issues, or feedback for us.
