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 view on a remote or local cluster.

The createLocalClusterConnection() mutation adds a connection from a multi-cluster view to a local view on the same cluster. Provide the name or identifier of the multi-cluster view, the name or identifier of the target local view, and routing tags. Tags are ClusterConnectionInputTag objects that control which queries LogScale routes to this connection. An optional queryPrefix filter restricts which events are visible through the connection. The MultiClusterSearch feature must be enabled before you call this mutation. To modify an existing connection, use updateLocalClusterConnection() instead.

Syntax

graphql
createLocalClusterConnection(
      input: CreateLocalClusterConnectionInput!
   ): LocalClusterConnection!

The required input argument takes a CreateLocalClusterConnectionInput object. Provide the name or identifier of the multi-cluster view, the name or identifier of the target local view, and routing tags. An optional queryPrefix filter restricts which events are visible through the connection. The mutation returns a non-null LocalClusterConnection object. See the Input Parameters section for field details.

Example

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

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 {
  createLocalClusterConnection(input:
         {multiClusterViewName: \"my-cluster\",
          targetViewName: \"humio\",
        } )
  { id }
}"
}
);


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();

Input Parameters

The input argument requires three fields and accepts one optional field. Provide the name or identifier of the multi-cluster view (multiClusterViewName) and the name or identifier of the local view to connect (targetViewName). The required tags field takes a list of ClusterConnectionInputTag objects that control which queries LogScale routes to this connection. The optional queryPrefix field accepts a LogScale query expression that restricts which events are visible through the connection; omit this field or pass an empty string to include all events.

Table: CreateLocalClusterConnectionInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
multiClusterViewNameStringyes Short-Term The name or unique identifier of the multi-cluster view for which to add 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.
targetViewNameStringyes Short-Term The name or unique identifier of the local view.

Returned Values

The mutation returns a LocalClusterConnection object representing the new connection. The id field contains the unique identifier for the connection; store this value if you need to delete or update the connection later. The clusterId field identifies the cluster that owns the connection. The targetViewId and targetViewName fields identify the connected local view. The targetViewType field indicates the type of the target view as a LocalTargetType enum value. The queryPrefix field reflects the filter expression configured for this connection, and tags returns the routing tags 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.