Summary

The setTagGroupings() mutation replaces all tag grouping rules on a repository with the provided set. Tag groupings control how LogScale partitions ingested data into segments by tag field values. Each rule specifies a tag field name and a group count. The group count determines how many distinct partitions LogScale creates for that field. Higher group counts narrow each partition. This improves query performance on high-cardinality fields but increases storage overhead. The mutation replaces all existing groupings atomically. The repository is never left in a partial state.

Syntax

graphql
setTagGroupings(
      repositoryName: String!,
      tagGroupings: [TagGroupingRuleInput!]!
   ): [TagGroupingRule!]!

Both arguments are required. Provide the repository name and a complete list of tag grouping rules to apply. The mutation replaces all existing groupings on the repository with the supplied list.

Input parameters

The mutation requires the repository name and a complete list of tag grouping rules. Each rule in the list must be a TagGroupingRuleInput object.

Table: Input parameters and datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation. Because one parameter uses a special datatype, an additional table follows with its fields.
repositoryName String! yes   The name of the repository on which to apply the new tag groupings.
tagGroupings [TagGroupingRuleInput!]! yes   The complete set of tag grouping rules to apply to the repository. This list replaces all existing groupings.

Each entry in the tagGroupings list must be a TagGroupingRuleInput object.

Table: TagGroupingRuleInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
groupCountIntyes   The number of groups the tag will be split into.
tagNameStringyes   The tag name to which the rule will apply.

Example

Raw
graphql
mutation {
  setTagGroupings( 
    repositoryName: "humio",
  tagGroupings: [ { tagName: "stuff", groupCount: 3 } ]
  ) 
  { groupCount }
}
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 {
  setTagGroupings( 
    repositoryName: \"humio\",
  tagGroupings: [ { tagName: \"stuff\", groupCount: 3 } ]
  ) 
  { groupCount }
}"
}
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 {
  setTagGroupings( 
    repositoryName: \"humio\",
  tagGroupings: [ { tagName: \"stuff\", groupCount: 3 } ]
  ) 
  { groupCount }
}"
}
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 { ^
  setTagGroupings(  ^
    repositoryName: \"humio\", ^
  tagGroupings: [ { tagName: \"stuff\", groupCount: 3 } ] ^
  )  ^
  { groupCount } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  setTagGroupings( 
    repositoryName: \"humio\",
  tagGroupings: [ { tagName: \"stuff\", groupCount: 3 } ]
  ) 
  { groupCount }
}"
}'
    "$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 {
  setTagGroupings( 
    repositoryName: \"humio\",
  tagGroupings: [ { tagName: \"stuff\", groupCount: 3 } ]
  ) 
  { groupCount }
}";
$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 {
  setTagGroupings( 
    repositoryName: \"humio\",
  tagGroupings: [ { tagName: \"stuff\", groupCount: 3 } ]
  ) 
  { groupCount }
}"
}'''

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 {
  setTagGroupings( 
    repositoryName: \"humio\",
  tagGroupings: [ { tagName: \"stuff\", groupCount: 3 } ]
  ) 
  { groupCount }
}"
}
);


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": {
    "setTagGroupings": [
      {
        "groupCount": 3
      }
    ]
  }
}

Returned values

The mutation returns [TagGroupingRule!]!. Each object includes the tagName and groupCount fields. Compare the returned list against your input to confirm the configuration was applied.

Table: TagGroupingRule Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
groupCountIntyes Short-Term  
tagNameStringyes Short-Term Â