Summary

Multi-cluster search federates query execution across multiple LogScale clusters from a single view. A multi-cluster view delegates search requests to connections that each point to a local view on the same cluster, routing queries based on connection tags.

The updateLocalClusterConnection() mutation modifies an existing connection between a multi-cluster view and a local view. You must supply the multi-cluster view name or identifier, the connection identifier, and routing tags. The optional queryPrefix and targetViewName fields let you update the event filter and the target local view respectively; omit them to leave those properties unchanged. The MultiClusterSearch feature must be enabled. To create a new connection, use createLocalClusterConnection() instead.

Syntax

graphql
updateLocalClusterConnection(
      input: UpdateLocalClusterConnectionInput!
   ): LocalClusterConnection!

The mutation accepts a single required input argument of type UpdateLocalClusterConnectionInput!. You must supply the multi-cluster view name or identifier (multiClusterViewName), the identifier of the connection to update (connectionId), and routing tags (tags). The optional targetViewName and queryPrefix fields let you change the target local view and event filter; omit them to leave those values unchanged.

The mutation returns a non-null LocalClusterConnection! object representing the updated connection.

Input parameters

The input argument requires three fields: the multi-cluster view name or identifier (multiClusterViewName), the identifier of the connection to update (connectionId), and a list of routing tags (tags). Tags are ClusterConnectionInputTag key-value pairs that control which queries LogScale routes to this connection; replacing them overwrites the existing tags on the connection. The optional targetViewName field changes the target local view; the optional queryPrefix field changes the LogScale query expression that filters which events are visible through the connection. Omit optional fields to leave those properties unchanged.

Table: UpdateLocalClusterConnectionInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
connectionIdStringyes Short-Term The unique identifier of the connection to update.
multiClusterViewNameStringyes Short-Term The name or unique identifier of the multi-cluster view that has the connection.
queryPrefixString  Short-Term Filter query that restricts the data visible through this connection.
tagsClusterConnectionInputTagyes Short-Term Additional tags that can be used to filter queries. See ClusterConnectionInputTag.
targetViewNameString  Short-Term The name or unique identifier of the local view with which to connect.

Example

Raw
graphql
mutation {
  updateLocalClusterConnection( input:
    { multiClusterViewName: "my-gang",
      connectionId: "abc123",
      queryPrefix: "the_gang"
    }
  )
 { clusterId }
}
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 {
  updateLocalClusterConnection( input:
    { multiClusterViewName: \"my-gang\",
      connectionId: \"abc123\",
      queryPrefix: \"the_gang\"
    }
  )
 { clusterId }
}"
}
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 {
  updateLocalClusterConnection( input:
    { multiClusterViewName: \"my-gang\",
      connectionId: \"abc123\",
      queryPrefix: \"the_gang\"
    }
  )
 { clusterId }
}"
}
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 { ^
  updateLocalClusterConnection( input: ^
    { multiClusterViewName: \"my-gang\", ^
      connectionId: \"abc123\", ^
      queryPrefix: \"the_gang\" ^
    } ^
  ) ^
 { clusterId } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updateLocalClusterConnection( input:
    { multiClusterViewName: \"my-gang\",
      connectionId: \"abc123\",
      queryPrefix: \"the_gang\"
    }
  )
 { clusterId }
}"
}'
    "$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 {
  updateLocalClusterConnection( input:
    { multiClusterViewName: \"my-gang\",
      connectionId: \"abc123\",
      queryPrefix: \"the_gang\"
    }
  )
 { clusterId }
}";
$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 {
  updateLocalClusterConnection( input:
    { multiClusterViewName: \"my-gang\",
      connectionId: \"abc123\",
      queryPrefix: \"the_gang\"
    }
  )
 { clusterId }
}"
}'''

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 {
  updateLocalClusterConnection( input:
    { multiClusterViewName: \"my-gang\",
      connectionId: \"abc123\",
      queryPrefix: \"the_gang\"
    }
  )
 { clusterId }
}"
}
);


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": {
    "updateLocalClusterConnection": {
      "clusterId": "def456"
    }
  }
}

Returned values

The mutation returns a LocalClusterConnection! object representing the updated state of the connection. The id field contains the unique connection identifier; store this value to update or delete the connection later. The clusterId field identifies the cluster that owns the connection. The targetViewId and targetViewName fields identify the local view the connection points to. The targetViewType field indicates the type of the target view as a LocalTargetType enum value. The queryPrefix field reflects the filter expression currently applied to the connection; a null or empty value means all events are visible. The tags field returns the routing tags on the connection as ClusterConnectionTag objects.

Table: LocalClusterConnection Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
clusterIdstringyes Short-Term The cluster identity of the connection.
idstringyes Short-Term The unique identifier of the connection.
queryPrefixstringyes Short-Term The cluster connection query prefix.
tags[ClusterConnectionTag]yes Short-Term The cluster connection tags. See ClusterConnectionTag.
targetViewIdstringyes Short-Term The unique identifier of the local view with which to connect.
targetViewNameRepoOrViewNameyes Short-Term The name of the local view with which to connect. RepoOrViewName is a scalar.
targetViewTypeLocalTargetTypeyes Short-Term The type of target view. See LocalTargetType.