The clearErrorOnFilterAlert() GraphQL mutation may be used to clear the error status on a filter alert. The status will be updated if the error reoccurs.

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

Syntax

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

graphql
clearErrorOnFilterAlert(
      input: ClearErrorOnFilterAlertInput!
   ): FilterAlert!

Below is an example of how this mutation field might be used:

Raw
graphql
mutation {
  clearErrorOnFilterAlert(input:
       { viewName: "humio", 
         id: "pvnPez4zbRDJqnS87HE1oZseiocfOGdN" } )
  {name, enabled}
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  clearErrorOnFilterAlert(input:
       { viewName: \"humio\", 
         id: \"pvnPez4zbRDJqnS87HE1oZseiocfOGdN\" } )
  {name, enabled}
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  clearErrorOnFilterAlert(input:
       { viewName: \"humio\", 
         id: \"pvnPez4zbRDJqnS87HE1oZseiocfOGdN\" } )
  {name, enabled}
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  clearErrorOnFilterAlert(input: ^
       { viewName: \"humio\",  ^
         id: \"pvnPez4zbRDJqnS87HE1oZseiocfOGdN\" } ) ^
  {name, enabled} ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  clearErrorOnFilterAlert(input:
       { viewName: \"humio\", 
         id: \"pvnPez4zbRDJqnS87HE1oZseiocfOGdN\" } )
  {name, enabled}
}"
}'
"$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $INGEST_TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $json = '{"query" : "mutation {
  clearErrorOnFilterAlert(input:
       { viewName: \"humio\", 
         id: \"pvnPez4zbRDJqnS87HE1oZseiocfOGdN\" } )
  {name, enabled}
}"
}';
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  clearErrorOnFilterAlert(input:
       { viewName: \"humio\", 
         id: \"pvnPez4zbRDJqnS87HE1oZseiocfOGdN\" } )
  {name, enabled}
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  clearErrorOnFilterAlert(input:
       { viewName: \"humio\", 
         id: \"pvnPez4zbRDJqnS87HE1oZseiocfOGdN\" } )
  {name, enabled}
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL/graphql',
  path: '/graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "clearErrorOnFilterAlert": {
      "name": "Great Filtration Watcher",
      "enabled": true
    }
  }
}

Given Datatypes

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

Table: ClearErrorOnFilterAlertInput

ParameterTypeRequiredDefaultDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 17, 2024
idstringyes The unique identifier of the filter alert.
viewNameRepoOrViewNameyes Name of the view of the filter alert. RepoOrViewName is a scalar.

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

ParameterTypeRequiredDefaultDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
actions[Action]yes List of unique identifiers for actions to fire on query result. See Action.
allowedActions[AssetAction]yes List of actions allowed on which to filter query results. See AssetAction.
descriptionstring  Description of the filter alert.
enabledbooleanyes Whether the filter alert is enabled.
idstringyes The unique identifier of the filter alert.
labels[string]yes Labels attached to the filter alert.
lastErrorstring  Last error encountered while running the filter alert.
lastErrorTimelong  Unix timestamp for last error.
lastSuccessfulPolllong  Unix timestamp for last successful poll of the filter alert query. If this is not quite recent, then the alert might be having problems.
lastTriggeredlong  Unix timestamp for last execution of trigger.
lastWarnings[string]yes Last warnings encountered while running the filter alert.
modifiedInfoModifiedInfo  User or token used to modify the asset. See ModifiedInfo. This is a preview and subject to change.
namestringyes The name of the filter alert.
packagePackageInstallation  The package of which the alert was installed. See PackageInstallation.
packageIdVersionedPackageSpecifier  The unique identifier of the package of which the alert was installed. VersionedPackageSpecifier is a scalar.
queryOwnershipQueryOwnershipyes Ownership of the query run by this alert. See QueryOwnership.
queryStringstringyes The LogScale query to execute.
throttleFieldstring  A field to throttle on. Can only be set if throttleTimeSeconds is set.
throttleTimeSecondslong  The throttle time in seconds.
yamlTemplateyamlyes YAML specification of the filter alert.