The createFilterAlert() GraphQL mutation may be used to create a filter alert.

For more information on filter alerts, see the Filter Alerts documentation page.

Syntax

Below is the syntax for the createFilterAlert() mutation field:

graphql
createFilterAlert(
      input: CreateFilterAlert!
   ): FilterAlert!

Given Datatypes

For the input CreateFilterAlert, there are several parameters that may be given. Below is a list of them along with their datatypes and a description of each:

Table: CreateFilterAlert

ParameterTypeRequired[a]DefaultDescription
viewNameRepoOrViewNameyes Name of the view of the filter alert.
namestringyes Name of the filter alert.
descriptionstringyes Description of the filter alert.
queryStringstringyes LogScale query to execute.
actionIdsOrNames[string]yes List of unique identifiers or names for actions to fire on query result. Actions in packages can be referred to as packagescope/packagename:actionname.
labels[string]=[]yes Labels attached to the filter alert.
enabledboolean  Flag indicating whether the filter alert is enabled.
throttleTimeSecondslong  Throttle time in seconds.
throttleFieldstring  A field to throttle on. Can only be set if throttleTimeSeconds is set.
runAsUserIdstring  The filter alert will run with the permissions of the user corresponding to this id if the queryOwnershipType field is set to User. If the queryOwnershipType is set to Organization, whilst runAsUserId is set, this will result in an error. If not specified, the filter alert will run with the permissions of the calling user. It requires the 'ChangeTriggersToRunAsOtherUsers' permission to set this field to a user id different from the calling user.
queryOwnershipTypeQueryOwnershipTypeyes Ownership of the query run by this filter alert. If value is User, ownership will be based on the runAsUserId field.

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.


Returned Datatypes

The returned datatype FilterAlert has its own parameters. Below is a list of them along with their datatypes and a description of each:

Table: FilterAlert

ParameterTypeRequired[a]DefaultDescription
idstringyes The unique identifier of the filter alert.
namestringyes Name of the filter alert.
descriptionstring  Description of the filter alert.
queryStringstringyes LogScale query to execute.
actions[Action]yes List of ids for actions to fire on query result.
labels[string]yes Labels attached to the filter alert.
enabledbooleanyes Flag indicating whether the filter alert is enabled.
throttleTimeSecondslong  Throttle time in seconds.
throttleFieldstring  A field to throttle on. Can only be set if throttleTimeSeconds is set.
lastTriggeredlong  Unix timestamp for last execution of trigger.
lastErrorTimelong  Unix timestamp for last error.
lastErrorstring  Last error encountered while running the filter alert.
lastWarnings[string]yes Last warnings encountered while running the filter alert.
yamlTemplateYAMLyes YAML specification of the filter alert.
packageIdVersionedPackageSpecifier  The unique identifier of the package of which the alert was installed.
packagePackageInstallation  The package of which the alert was installed.
queryOwnershipQueryOwnershipyes Ownership of the query run by this alert.

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.