Summary

The publishLogCollectorConfiguration() mutation publishes a new active version of an existing Log Collector configuration. Supplying updated YAML replaces the current active configuration content and increments the version number. Any Log Collector instances assigned to this configuration pick up the new version on their next configuration poll. Use this mutation after createLogCollectorConfiguration() to push configuration changes to an already-existing configuration.

The currentVersion argument enforces optimistic concurrency control: the mutation fails if the version stored in the system does not match the value you supply. Retrieve the current version from getLogCollectorDetails() or from the response of a previous publishLogCollectorConfiguration() call before submitting an update.

Syntax

graphql
publishLogCollectorConfiguration(
      id: String!,
      yaml: String,
      currentVersion: Int!
   ): LogCollectorConfiguration!

Provide the unique identifier of the Log Collector configuration in id and the expected current version number in currentVersion. Supply the updated YAML configuration content in yaml; omitting it leaves the configuration content unchanged but still increments the version number.

The mutation returns a non-null LogCollectorConfiguration object representing the published configuration. The returned version field reflects the incremented version number after the publish operation. See the Returned Values section for all available fields.

Example

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

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 {
  publishLogCollectorConfiguration( 
      id: \"12345\",
      currentVersion: 1
  )
  { name, modifiedAt }
}"
}
);


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": {
    "publishLogCollectorConfiguration": {
      "name": "abc123",
      "modifiedAt": "2025-12-18T20:39:35"
    }
  }
}

Input Parameters

Provide the unique identifier of the Log Collector configuration and its current version number. Optionally supply updated YAML content to replace the existing configuration.

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation.
currentVersion Int yes ย  The current version number of the Log Collector configuration. This value must match the version stored in the system. If the versions do not match โ€” because another caller updated the configuration after you last read it โ€” the mutation fails, preventing conflicting concurrent updates. Retrieve the current version from getLogCollectorDetails() or from the version field returned by the previous mutation call.
id String yes ย  The unique identifier of the Log Collector configuration to update. Retrieve this ID from getLogCollectorDetails() or from the response of createLogCollectorConfiguration().
yaml String no ย  The updated Log Collector configuration in YAML format. The YAML content must conform to the Log Collector configuration schema. When published, assigned Log Collector instances pick up the new content on their next configuration poll. Omitting this argument leaves the existing YAML content unchanged while still incrementing the version number.

Returned Values

The mutation returns a LogCollectorConfiguration object representing the configuration after the publish operation completes. The version field contains the incremented version number resulting from this publish call โ€” store this value to use as currentVersion in subsequent updates. The modifiedAt and modifiedBy fields record when and by whom the configuration was last published. The yaml field contains the now-active configuration content. The instances field reflects how many Log Collector instances are currently assigned to this configuration. The following table lists all available fields: