Summary

The createLogCollectorGroup() mutation creates a Log Collector group. Groups organize Log Collector instances and associate them with one or more configurations. Use this mutation to establish a new group before assigning configurations or updating group properties.

Syntax

graphql
createLogCollectorGroup(
      name: String!,
      filter: String,
      configIds: [String!]
   ): LogCollectorGroup!

The name argument is required and sets the display name for the new group. The filter argument is optional and scopes which Log Collector instances belong to the group. The configIds argument is optional and associates one or more configuration identifiers with the group at creation time.

The mutation returns a non-null LogCollectorGroup! object. Request id to retrieve the group identifier required by subsequent update and delete mutations. The Returned Values section lists all available fields.

Example

Raw
graphql
mutation {
  createLogCollectorGroup(
         name: "my-lc-group" )
  { id, name }
}
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 {
  createLogCollectorGroup(
         name: \"my-lc-group\" )
  { id, name }
}"
}
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 {
  createLogCollectorGroup(
         name: \"my-lc-group\" )
  { id, name }
}"
}
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 { ^
  createLogCollectorGroup( ^
         name: \"my-lc-group\" ) ^
  { id, name } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  createLogCollectorGroup(
         name: \"my-lc-group\" )
  { id, name }
}"
}'
    "$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 {
  createLogCollectorGroup(
         name: \"my-lc-group\" )
  { id, name }
}";
$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 {
  createLogCollectorGroup(
         name: \"my-lc-group\" )
  { id, name }
}"
}'''

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 {
  createLogCollectorGroup(
         name: \"my-lc-group\" )
  { id, name }
}"
}
);


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": {
    "createLogCollectorGroup": {
      "id": "abc123",
      "name": "my-lc-group"
    }
  }
}

Input Parameters

The name argument is required. The filter and configIds arguments are optional and can be supplied at creation time or added later through update mutations.

Table: Input Parameters and Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation.
configIds [String!]     A list of configuration identifiers to associate with the group. Each identifier in the list must be non-null. Omitting this argument creates the group without any configuration associations; use updateLogCollectorGroupConfigIds() to add them later.
filter String     A filter expression that determines which Log Collector instances belong to this group. Omitting this argument creates the group without a filter; use updateLogCollectorGroupFilter() to set or change it later.
name String! yes   The display name for the new Log Collector group. This value identifies the group in subsequent queries and mutations.

Returned Values

The mutation returns a LogCollectorGroup object representing the newly created group. The returned object includes the group identifier, name, filter, associated configuration identifiers, and status information for the Log Collector instances in the group.

Table: LogCollectorGroup Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
collectorCountInt  Short-Term text
collectorsAtWantedVersionInt  Short-Term  
collectorsWithVersionConflictInt  Short-Termadded in 1.255 
configurationsLogCollectorConfigurationyes Short-Term The log collector's configurations. See LogCollectorConfiguration.
conflictingGroupNamesStringyes Short-Termadded in 1.255 
filterString  Short-Term The filter used with the log collector.
idStringyes Short-Term The unique identifier for the group.
nameStringyes Short-Term The name of the log collector group.
onlyUsesRemoteUpdatesBooleanyes Short-Term Whether the group only uses remove updates.
wantedVersionString  Short-Term The wanted version.