{tenantId}/log-alerts

create alert defintion for log alerts

This API is used to create log alert definitions. logs:manage scope is required to access this API.

Note:

  1. Values against the component field and Resource Attribute value will be used to group the alerts.
  2. If any string in component or Resource Attribute value or subject or description prefixes with $, it would be considered a holder. Alert service will try to fetch the value of this field in logs data and replace the placeholder.
  3. If any tokens are being added to the log alert definition, please ensure these tokens have a space before and after them. For example, "description": "Test host $host $name "

Ex URL: https://api.opsramp.com/alertdefinitions/api/v3/tenants/7657adf4-1b62-410c-ad11-0131a8fc3769/log-alerts

Request Parameters:

Parameter

Description

Mandatory / Optional

Type

Possible Values

name

Name of the Log Alert Definition

Mandatory

string

type

Type of Alert Definition

Mandatory

string

log

alertNoData

Alert when no logs found with given log filter query

if there is no data coming in, then you can choose one of the options:
Do not trigger alert - No alert will be triggered, if no data comes in.
Trigger critical alert - A critical alert will be triggered, if no data comes in.
Trigger warning alert - A warning alert will be triggered, if no data comes in.

Mandatory

string

noalert - When user don't want any alert when no logs found against given log query
critical - when user wants critical alert against Log NoData  Alert
warning - when user wants warning alert against Log NoData  Alert

query

Log Filter Query used to alert

Mandatory

JSON string

healQuery

Log Filter Query used to heal the existing critical or warning alert

  • By default, alert healing will be done when there are no logs found matching with given logs filter criteria
  • To use healQuery, Log Query Filter used to raise alert should have atleast one line filter.

    When noAutoHeal is opted, any alert created against this alert definition will not be healed automatically and should be heal manually.

Optional

JSON string

""
noAutoHeal 
valid line filter

notification.subject

Subject with which Log alert should be generated

Mandatory

string

notification.description

Description with which Log alert should be generated

Mandatory

string

conditions.severity

Severity with which log alert should be generated

Mandatory

string

warning, critical

entityType

Select either Resource or Client. Alerts can be on a specific resource like a server, or a client-level alert.

Mandatory

string

RESOURCE, CLIENT

component

This is to identify the alert.

Optional

string

resourceAttributes

Define a resource attribute to the alert.
Note: The resource attributes can be defined only for Resource entity type.
If you select the attribute value as $name, it will go to the logs and get the first value of name from all the set of logs found matching with given filter criteria and display it in the alert details page.

Mandatory if entityType is Resource

JSON

labels

Alert custom tags. This is reflected in the alert details page

Optional

JSON

schedule.startTime

schedule.endTime

startTime, endTime is valid for daily, weekly and monthly patterns

startTime, endTime will be the look up period when schedule trigger

mandatory for daily, weekly and monthly patterns

string

startTime and endTime difference should not be more than 2hrs.

"startTime": "15:30:00+0000",
"endTime": "17:00:00+0000",

schedule.timezone

  • Timezone for which the user wants to set as Local time. For eg "timezone": "America/Denver will let the users get the local time in America/Denver Timezone

Ex: Pacific/Honolulu
America/Anchorage
America/Puerto_Rico
America/Los_Angeles

Optional

string

schedule.pattern.type

pattern type defines the alert definition schedule type

Mandatory

string

 "second", "minute", "daily", "weekly", "monthly"

schedule.pattern.repeatFrequency

defines the frequency with which logs should be checked for minute schedule pattern types.

Mandatory for second, minute, daily schedule pattern types

int

Valid values for minute frequency:
1, 2, 3, 4, 5, 6, 10, 15, 20, 30

schedule.pattern.weekDays

weekDays accepts array of days.
If user wants to schedule log alert definition on Monday and Thursday of every week then weekDays value should be "monday,thursday"

Mandatory for weekly schedule pattern

string

Valid values for weekDays:
sunday, monday, tuesday, wednesday, thursday, friday, saturday

schedule.pattern.dayOfMonth

Numeric day of Month

Ex: To schedule on 4th and 6th of every month.
"dayOfMonth": "4,6"

Mandatory for monthly schedule pattern

string

1-31

dayOfMonth field should be provided with comma separated dates.

schedule.pattern.weekIndex

schedule.pattern.dayOfWeek

weekIndex represents index of the week in the month and dayOfWeek represents day.


Ex:  To schedule on 2nd Tuesday of the month
"weekIndex": "Second",
"dayOfWeek": "tuesday" 

Mandatory for monthly schedule pattern

string

Valid values for dayOfWeek:
sunday, monday, tuesday, wednesday, thursday, friday, saturday

Valid values for weekIndex:
First, Second, Third, Fourth, Fifth, Last

Path Parameters

  • tenantIdstringrequired

    Describes the client uuid

Request Body

application/json

  • alertsarray

Loading Examples...

Responses

  • alertsarray

  • errorsarray

Loading Examples...

Deletes multiple log alert definitions

Path Parameters

  • tenantIdstringrequired

    Describes the client uuid

Request Body

application/json

  • alertIdsarray of strings

Loading Examples...

Responses

    Loading Examples...