Summary

The updateLogCollectorConfigurationName() mutation renames an existing Log Collector configuration. Use it to reflect a change in purpose or deployment context after creating a configuration with createLogCollectorConfiguration().

Syntax

graphql
updateLogCollectorConfigurationName(
      configId: String!, name: String!
   ): LogCollectorConfiguration!

The configId argument identifies the Log Collector configuration to rename. The name argument sets the new name. The mutation returns a non-null LogCollectorConfiguration! object reflecting the updated configuration.

Input parameters

Provide the unique identifier of the Log Collector configuration and the new name. Use logCollectorConfiguration() to retrieve the configuration ID before calling this mutation.

Table: Input parameters and 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 rename. Retrieve this value using logCollectorConfiguration().
name String yes   The new name for the configuration. This replaces the existing name and appears in API responses and the LogScale UI.

Example

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

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 {
  updateLogCollectorConfigurationName( 
     configId: \"abc123\",
     name: \"our-logcollector\"
  )
 { description }
}"
}
);


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": {
    "updateLogCollectorConfigurationName": {
      "description": "The Log Collector"
    }
  }
}

Returned values

The mutation returns a LogCollectorConfiguration! object. Request name to confirm the updated name. The returned object also exposes the configuration description, YAML content, the user who last modified it, the modification timestamp, and the Log Collector version.

Table: LogCollectorConfiguration Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
descriptionString  Short-Term A description of the Log Collector configuration.
draftString  Short-Term The configuration draft.
draftModifiedAtDateTime  Short-Term The date and time of the last draft of the configuration.
idStringyes Short-Term The unique identifier for the log collector configuration.
instancesIntyes Short-Term The number of instances.
isTestRunningBooleanyes Short-Term Whether a test is running.
modifiedAtDateTimeyes Short-Term The date and time of the current configuration.
modifiedByStringyes Short-Term Who last modified the configuration.
nameStringyes Short-Term The name assigned to the log collector configuration.
versionIntyes Short-Term The version used.
yamlString  Short-Term Configuration in YAML format.
yamlCharactersCountIntyes Short-Term The yaml character count.