Skip to main content
Create an alert
curl --request POST \
  --url https://api.coralogix.com/mgmt/openapi/latest/alerts/alerts-general/v3 \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "activeOn": {
    "dayOfWeek": [
      "DAY_OF_WEEK_MONDAY_OR_UNSPECIFIED"
    ],
    "endTime": {
      "hours": 14,
      "minutes": 30
    },
    "startTime": {
      "hours": 14,
      "minutes": 30
    }
  },
  "deleted": false,
  "description": "Alert description",
  "enabled": true,
  "entityLabels": {
    "key": "value"
  },
  "groupByKeys": [
    [
      "key1",
      "key2"
    ]
  ],
  "incidentsSettings": {
    "minutes": 30,
    "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
  },
  "name": "My Alert",
  "notificationGroup": {
    "destinations": [
      {
        "connectorId": "connector_id_example",
        "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED",
        "presetId": "preset_id_example",
        "resolvedRouteOverrides": {
          "configOverrides": {}
        },
        "triggeredRoutingOverrides": {
          "configOverrides": {}
        }
      }
    ],
    "groupByKeys": [
      [
        "key1",
        "key2"
      ]
    ],
    "router": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
    },
    "webhooks": [
      {
        "integration": {
          "integrationId": 123
        },
        "minutes": 15,
        "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
      }
    ]
  },
  "notificationGroupExcess": [
    {
      "destinations": [
        {
          "connectorId": "connector_id_example",
          "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED",
          "presetId": "preset_id_example",
          "resolvedRouteOverrides": {
            "configOverrides": {}
          },
          "triggeredRoutingOverrides": {
            "configOverrides": {}
          }
        }
      ],
      "groupByKeys": [
        [
          "key1",
          "key2"
        ]
      ],
      "router": {
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
      },
      "webhooks": [
        {
          "integration": {
            "integrationId": 123
          },
          "minutes": 15,
          "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
        }
      ]
    }
  ],
  "phantomMode": false,
  "priority": "ALERT_DEF_PRIORITY_P5_OR_UNSPECIFIED",
  "tracingThreshold": {
    "notificationPayloadFilter": [
      [
        "obj.field"
      ]
    ],
    "rules": [
      {
        "condition": {
          "conditionType": "TRACING_THRESHOLD_CONDITION_TYPE_MORE_THAN_OR_UNSPECIFIED",
          "spanAmount": 100,
          "timeWindow": {
            "tracingTimeWindowValue": "TRACING_TIME_WINDOW_VALUE_MINUTES_5_OR_UNSPECIFIED"
          }
        }
      }
    ],
    "tracingFilter": {
      "simpleFilter": {
        "latencyThresholdMs": 1000,
        "tracingLabelFilters": {
          "applicationName": [
            {}
          ],
          "operationName": [
            {}
          ],
          "serviceName": [
            {}
          ],
          "spanFields": [
            {}
          ],
          "subsystemName": [
            {}
          ]
        }
      }
    }
  },
  "type": "ALERT_DEF_TYPE_LOGS_IMMEDIATE_OR_UNSPECIFIED"
}'
{
  "alertDef": {
    "alertDefProperties": {
      "activeOn": {
        "dayOfWeek": [
          "DAY_OF_WEEK_MONDAY_OR_UNSPECIFIED"
        ],
        "endTime": {
          "hours": 14,
          "minutes": 30
        },
        "startTime": {
          "hours": 14,
          "minutes": 30
        }
      },
      "deleted": false,
      "description": "Alert description",
      "enabled": true,
      "entityLabels": {
        "key": "value"
      },
      "groupByKeys": [
        [
          "key1",
          "key2"
        ]
      ],
      "incidentsSettings": {
        "minutes": 30,
        "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
      },
      "name": "My Alert",
      "notificationGroup": {
        "destinations": [
          {
            "connectorId": "connector_id_example",
            "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED",
            "presetId": "preset_id_example",
            "resolvedRouteOverrides": {},
            "triggeredRoutingOverrides": {}
          }
        ],
        "groupByKeys": [
          [
            "key1",
            "key2"
          ]
        ],
        "router": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
        },
        "webhooks": [
          {
            "integration": {},
            "minutes": 15,
            "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
          }
        ]
      },
      "notificationGroupExcess": [
        {
          "destinations": [
            {
              "connectorId": "connector_id_example",
              "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED",
              "presetId": "preset_id_example",
              "resolvedRouteOverrides": {},
              "triggeredRoutingOverrides": {}
            }
          ],
          "groupByKeys": [
            [
              "key1",
              "key2"
            ]
          ],
          "router": {
            "id": "123e4567-e89b-12d3-a456-426614174000",
            "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
          },
          "webhooks": [
            {
              "integration": {},
              "minutes": 15,
              "notifyOn": "NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED"
            }
          ]
        }
      ],
      "phantomMode": false,
      "priority": "ALERT_DEF_PRIORITY_P5_OR_UNSPECIFIED",
      "tracingImmediate": {
        "notificationPayloadFilter": [
          [
            "obj.field"
          ]
        ],
        "tracingFilter": {
          "simpleFilter": {
            "latencyThresholdMs": 1000,
            "tracingLabelFilters": {
              "applicationName": [
                "<any>"
              ],
              "operationName": [
                "<any>"
              ],
              "serviceName": [
                "<any>"
              ],
              "spanFields": [
                "<any>"
              ],
              "subsystemName": [
                "<any>"
              ]
            }
          }
        }
      },
      "type": "ALERT_DEF_TYPE_LOGS_IMMEDIATE_OR_UNSPECIFIED"
    },
    "alertVersionId": "<string>",
    "createdTime": "2023-10-01T12:00:00.000Z",
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "lastTriggeredTime": "2023-10-01T12:00:00.000Z",
    "status": "ALERT_DEF_STATUS_UNSPECIFIED",
    "updatedTime": "2023-10-01T12:00:00.000Z"
  }
}

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties
  • Alert definition properties

User-configurable properties of an alert definition

name
string
required

The name of the alert definition

Example:

"My Alert"

priority
enum<string>
required
Available options:
ALERT_DEF_PRIORITY_P5_OR_UNSPECIFIED,
ALERT_DEF_PRIORITY_P4,
ALERT_DEF_PRIORITY_P3,
ALERT_DEF_PRIORITY_P2,
ALERT_DEF_PRIORITY_P1
type
enum<string>
required
Available options:
ALERT_DEF_TYPE_LOGS_IMMEDIATE_OR_UNSPECIFIED,
ALERT_DEF_TYPE_LOGS_THRESHOLD,
ALERT_DEF_TYPE_LOGS_ANOMALY,
ALERT_DEF_TYPE_LOGS_RATIO_THRESHOLD,
ALERT_DEF_TYPE_LOGS_NEW_VALUE,
ALERT_DEF_TYPE_LOGS_UNIQUE_COUNT,
ALERT_DEF_TYPE_LOGS_TIME_RELATIVE_THRESHOLD,
ALERT_DEF_TYPE_METRIC_THRESHOLD,
ALERT_DEF_TYPE_METRIC_ANOMALY,
ALERT_DEF_TYPE_TRACING_IMMEDIATE,
ALERT_DEF_TYPE_TRACING_THRESHOLD,
ALERT_DEF_TYPE_FLOW,
ALERT_DEF_TYPE_SLO_THRESHOLD
activeOn
object

Defines when an alert should be active based on days of the week and time windows

deleted
boolean

Whether the alert has been marked as deleted

Example:

false

description
string

A detailed description of what the alert monitors and when it triggers

Example:

"Alert description"

enabled
boolean

Whether the alert is currently active and monitoring

Example:

true

entityLabels
object

Labels used to identify and categorize the alert entity

Example:
{ "key": "value" }
groupByKeys
string[]

Keys used to group and aggregate alert data

incidentsSettings
object
notificationGroup
object
notificationGroupExcess
Alert definition notification group · object[]
phantomMode
boolean

Whether the alert is in phantom mode (creating incidents or not)

Example:

false

tracingThreshold
object

Configuration for alerts based on trace count thresholds

Response

A response that contains the newly created alert definition

alertDef
object
required

This data structure represents an alert definition