The clearErrorOnAggregateAlert() GraphQL mutation is used to clear an error on an aggregate alert.

For more information on aggregate alerts, see the Aggregate Alerts documentation page.

Syntax

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

graphql
clearErrorOnAggregateAlert(
      input: ClearErrorOnAggregateAlertInput!
   ): AggregateAlert!

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

Raw
graphql
mutation {
  clearErrorOnAggregateAlert(input:
       { viewName: "humio", 
         id: "jmcLeo2mnELCmeS87HE1oZseiocfOGdN"} )
  {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 {
  clearErrorOnAggregateAlert(input:
       { viewName: \"humio\", 
         id: \"jmcLeo2mnELCmeS87HE1oZseiocfOGdN\"} )
  {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 {
  clearErrorOnAggregateAlert(input:
       { viewName: \"humio\", 
         id: \"jmcLeo2mnELCmeS87HE1oZseiocfOGdN\"} )
  {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 { ^
  clearErrorOnAggregateAlert(input: ^
       { viewName: \"humio\",  ^
         id: \"jmcLeo2mnELCmeS87HE1oZseiocfOGdN\"} ) ^
  {name, enabled} ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  clearErrorOnAggregateAlert(input:
       { viewName: \"humio\", 
         id: \"jmcLeo2mnELCmeS87HE1oZseiocfOGdN\"} )
  {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 {
  clearErrorOnAggregateAlert(input:
       { viewName: \"humio\", 
         id: \"jmcLeo2mnELCmeS87HE1oZseiocfOGdN\"} )
  {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 {
  clearErrorOnAggregateAlert(input:
       { viewName: \"humio\", 
         id: \"jmcLeo2mnELCmeS87HE1oZseiocfOGdN\"} )
  {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 {
  clearErrorOnAggregateAlert(input:
       { viewName: \"humio\", 
         id: \"jmcLeo2mnELCmeS87HE1oZseiocfOGdN\"} )
  {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": {
    "clearErrorOnAggregateAlert": {
      "name": "Special Aggregator",
      "enabled": true
    }
  }
}

Given Datatypes

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

Table: ClearErrorOnAggregateAlertInput

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
idlongyes The unique identifier of the aggregate alert.
viewNameRepoOrViewNameyes The name of the view of the aggregate alert. RepoOrViewName is a scalar.

Returned Datatypes

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

Table: AggregateAlert

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 23, 2024
actions[Action]yes List of actions to fire on query result. See Action.
allowedActions[AssetAction]yes List of actions allowed to fire on query result. See AssetAction.
descriptionstring  Description of the aggregate alert.
enabledbooleanyes Flag indicating whether the aggregate alert is enabled.
idstringyes Unique identifier of of the aggregate alert.
labels[string]yes Labels attached to the aggregate alert.
lastErrorstring  Last error encountered while running the aggregate alert.
lastSuccessfulPolllong  Unix timestamp for last successful poll of the aggregate alert query. If this isn't very recent, the alert might have problems.
lastTriggeredlong  Unix timestamp for last execution of trigger.
lastWarnings[string]yes Last warnings encountered while running the aggregate alert.
modifiedInfoModifiedInfoyes Information about the aggregate alert that was modified. See ModifiedInfo.
namestringyes Name of the aggregate alert.
packagePackageInstallation  The package of which the aggregate alert was installed. See PackageInstallation.
packageIdVersionedPackageSpecifier  The unique identifier of the package of the aggregate alert template. VersionedPackageSpecifier is a scalar.
queryOwnershipQueryOwnershipyes Ownership of the query run by this alert. See QueryOwnership.
queryStringstringyes LogScale query to execute.
queryTimestampTypeQueryTimestampTypeyes Timestamp type to use for a query. See QueryTimestampType and the FAQ: How Does LogScale Handle Ingest Delays in Aggregate Alerts KB article.
searchIntervalSecondslongyes Search interval in seconds.
throttleFieldstring  A field to throttle on.
throttleTimeSecondslongyes Throttle time in seconds.
triggerModeTriggerModeyes Trigger mode used for triggering the alert. See TriggerMode and the FAQ: How Does LogScale Handle Ingest Delays in Aggregate Alerts KB article.
yamlTemplateyamlyes YAML specification of the aggregate alert.