Summary

The deleteLogCollectorConfiguration() mutation permanently removes a Log Collector configuration from LogScale. Deletion is irreversible. You must supply both the configuration ID and its current version ID. The version ID acts as an optimistic concurrency guard: the mutation fails if the stored version does not match the value you supply, preventing deletion of a configuration that has been updated since you last retrieved it.

Before deleting a configuration, verify that no Log Collector instances are assigned to it. Deleting an assigned configuration does not automatically reassign the affected instances; those instances lose their configuration reference. Use the logCollectorConfiguration() query to retrieve the current version ID and check the instances field before proceeding.

Syntax

graphql
deleteLogCollectorConfiguration(
      configId: String!, versionId: Int!
   ): Boolean!

Both configId and versionId are required. configId identifies the configuration to delete. versionId is an optimistic concurrency guard: the mutation fails if the stored version number does not match the value you supply. This prevents deletion of a configuration that has been updated by another caller since you last retrieved it. Retrieve both values with the logCollectorConfiguration() query before calling this mutation.

The mutation returns Boolean!. On success it returns true. Errors, including a version mismatch or an unknown configuration ID, are raised as GraphQL errors rather than returned as false.

Example

Raw
graphql
mutation {
  deleteLogCollectorConfiguration( 
         configId: "abc123",
         versionId: 24
  )
}
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 {
  deleteLogCollectorConfiguration( 
         configId: \"abc123\",
         versionId: 24
  )
}"
}
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 {
  deleteLogCollectorConfiguration( 
         configId: \"abc123\",
         versionId: 24
  )
}"
}
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 { ^
  deleteLogCollectorConfiguration(  ^
         configId: \"abc123\", ^
         versionId: 24 ^
  ) ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  deleteLogCollectorConfiguration( 
         configId: \"abc123\",
         versionId: 24
  )
}"
}'
    "$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 {
  deleteLogCollectorConfiguration( 
         configId: \"abc123\",
         versionId: 24
  )
}";
$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 {
  deleteLogCollectorConfiguration( 
         configId: \"abc123\",
         versionId: 24
  )
}"
}'''

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 {
  deleteLogCollectorConfiguration( 
         configId: \"abc123\",
         versionId: 24
  )
}"
}
);


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": {
    "deleteLogCollectorConfiguration": true
  }
}

Input Parameters

Both parameters are required. Retrieve these values from the logCollectorConfiguration() query before calling this mutation. Check the instances field in the response to confirm no Log Collector instances are assigned to the configuration before deleting.

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation.
configId string yes ย  The unique identifier of the Log Collector configuration to delete. Retrieve this value with the logCollectorConfiguration() query or from the response of createLogCollectorConfiguration().
versionId integer yes ย  The version number of the configuration to delete. This value is an optimistic concurrency guard: the mutation fails if the stored version does not match, preventing deletion of a configuration that has been updated since you last retrieved it. Retrieve the current version with the logCollectorConfiguration() query. The version increments with each call to publishLogCollectorConfiguration().

Returned Values

The mutation returns Boolean!. On success it returns true. Failure conditions โ€” including a version mismatch, an unknown configuration ID, or insufficient permissions โ€” are raised as GraphQL errors rather than returned as false. Check the errors field in the GraphQL response when the mutation does not return true.