Summary

The deleteEventForwardingRule() mutation permanently removes an event forwarding rule from a repository. Event forwarding rules define which events a repository routes to an external forwarder destination, based on a query filter. After deletion, the rule no longer matches or routes any events. The operation is irreversible — the rule identifier cannot be reused and must be recreated with createEventForwardingRule() if needed again. To change the query filter, destination, or other properties of an existing rule without removing it, use updateEventForwardingRule() instead.

Syntax

graphql
deleteEventForwardingRule(
      input: DeleteEventForwardingRule!
   ): Boolean!

The mutation requires a DeleteEventForwardingRule input object containing two fields: viewName, which identifies the repository that owns the rule, and id, the unique identifier of the rule to delete. Retrieve the id value from the eventForwardingRules field on the repository() query before calling this mutation. See the Related section for an example query.

The mutation returns a non-null Boolean! value. A true result confirms that the rule was deleted successfully. The mutation fails and returns an error if the specified rule does not exist in the named repository or if the authenticated caller lacks sufficient permissions.

Example

Raw
graphql
mutation {
  deleteEventForwardingRule( input: 
       { viewName: "humio", 
         id: "abc123"}
  )
}
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 {
  deleteEventForwardingRule( input: 
       { viewName: \"humio\", 
         id: \"abc123\"}
  )
}"
}
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 {
  deleteEventForwardingRule( input: 
       { viewName: \"humio\", 
         id: \"abc123\"}
  )
}"
}
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 { ^
  deleteEventForwardingRule( input:  ^
       { viewName: \"humio\",  ^
         id: \"abc123\"} ^
  ) ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  deleteEventForwardingRule( input: 
       { viewName: \"humio\", 
         id: \"abc123\"}
  )
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  deleteEventForwardingRule( input: 
       { viewName: \"humio\", 
         id: \"abc123\"}
  )
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
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 {
  deleteEventForwardingRule( input: 
       { viewName: \"humio\", 
         id: \"abc123\"}
  )
}"
}'''

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 {
  deleteEventForwardingRule( input: 
       { viewName: \"humio\", 
         id: \"abc123\"}
  )
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  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": {
    "deleteEventForwardingRule": true
  }
}

Input Parameters

The DeleteEventForwardingRule input requires two fields. The viewName field identifies the repository that owns the rule — despite the field name, this must be a repository name, not a view name. The id field is the unique identifier of the rule to delete; it is assigned at rule creation and returned by the eventForwardingRules field on the repository() query. Both fields are required; omitting either causes the mutation to fail.

Table: DeleteEventForwardingRule Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
idStringyes   The unique id for the event forwarding rule
repoNameStringyes   The name of the repository that the event forwarding rule is for