Summary

The addLimitV2() mutation adds a limit to an organization. The limit defines ingest, storage, and scan quotas. It also controls login access, self-service options, flight control, contractual type, and measurement type.

Syntax

graphql
addLimitV2(
      input: AddLimitV2Input!
   ): LimitV2!

The mutation accepts a single required input argument of type AddLimitV2Input!. The input type specifies the limit name, login access, retention settings, trial status, self-service flags, contractual type, and measurement type. The Input Parameters section lists all accepted fields.

The mutation returns a non-null LimitV2! object representing the newly created limit. The Returned Values section lists the available fields.

Example

Raw
graphql
mutation {
  addLimitV2(input: 
       {limitName: "limiter1", 
        allowLogin: true, allowSelfService: true,
        allowFlightControl: true,
        dailyIngest: 1000, retention: 1000,
        dailyIngestContractualType: Limited,
        dailyScanContractualType: Limited,
        storageContractualType: Limited,
        measurementType: SegmentWriteSize,
        maxRetention: 1000
        dateType: "date",
        trial: false
      } )
  {id, limitName, storageLimit{includeUsage} }
}
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 {
  addLimitV2(input: 
       {limitName: \"limiter1\", 
        allowLogin: true, allowSelfService: true,
        allowFlightControl: true,
        dailyIngest: 1000, retention: 1000,
        dailyIngestContractualType: Limited,
        dailyScanContractualType: Limited,
        storageContractualType: Limited,
        measurementType: SegmentWriteSize,
        maxRetention: 1000
        dateType: \"date\",
        trial: false
      } )
  {id, limitName, storageLimit{includeUsage} }
}"
}
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 {
  addLimitV2(input: 
       {limitName: \"limiter1\", 
        allowLogin: true, allowSelfService: true,
        allowFlightControl: true,
        dailyIngest: 1000, retention: 1000,
        dailyIngestContractualType: Limited,
        dailyScanContractualType: Limited,
        storageContractualType: Limited,
        measurementType: SegmentWriteSize,
        maxRetention: 1000
        dateType: \"date\",
        trial: false
      } )
  {id, limitName, storageLimit{includeUsage} }
}"
}
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 { ^
  addLimitV2(input:  ^
       {limitName: \"limiter1\",  ^
        allowLogin: true, allowSelfService: true, ^
        allowFlightControl: true, ^
        dailyIngest: 1000, retention: 1000, ^
        dailyIngestContractualType: Limited, ^
        dailyScanContractualType: Limited, ^
        storageContractualType: Limited, ^
        measurementType: SegmentWriteSize, ^
        maxRetention: 1000 ^
        dateType: \"date\", ^
        trial: false ^
      } ) ^
  {id, limitName, storageLimit{includeUsage} } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  addLimitV2(input: 
       {limitName: \"limiter1\", 
        allowLogin: true, allowSelfService: true,
        allowFlightControl: true,
        dailyIngest: 1000, retention: 1000,
        dailyIngestContractualType: Limited,
        dailyScanContractualType: Limited,
        storageContractualType: Limited,
        measurementType: SegmentWriteSize,
        maxRetention: 1000
        dateType: \"date\",
        trial: false
      } )
  {id, limitName, storageLimit{includeUsage} }
}"
}'
    "$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 {
  addLimitV2(input: 
       {limitName: \"limiter1\", 
        allowLogin: true, allowSelfService: true,
        allowFlightControl: true,
        dailyIngest: 1000, retention: 1000,
        dailyIngestContractualType: Limited,
        dailyScanContractualType: Limited,
        storageContractualType: Limited,
        measurementType: SegmentWriteSize,
        maxRetention: 1000
        dateType: \"date\",
        trial: false
      } )
  {id, limitName, storageLimit{includeUsage} }
}";
$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 {
  addLimitV2(input: 
       {limitName: \"limiter1\", 
        allowLogin: true, allowSelfService: true,
        allowFlightControl: true,
        dailyIngest: 1000, retention: 1000,
        dailyIngestContractualType: Limited,
        dailyScanContractualType: Limited,
        storageContractualType: Limited,
        measurementType: SegmentWriteSize,
        maxRetention: 1000
        dateType: \"date\",
        trial: false
      } )
  {id, limitName, storageLimit{includeUsage} }
}"
}'''

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 {
  addLimitV2(input: 
       {limitName: \"limiter1\", 
        allowLogin: true, allowSelfService: true,
        allowFlightControl: true,
        dailyIngest: 1000, retention: 1000,
        dailyIngestContractualType: Limited,
        dailyScanContractualType: Limited,
        storageContractualType: Limited,
        measurementType: SegmentWriteSize,
        maxRetention: 1000
        dateType: \"date\",
        trial: false
      } )
  {id, limitName, storageLimit{includeUsage} }
}"
}
);


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": {
    "addLimitV2": {
      "id": "abc123",
      "limitName": "limiter1",
      "storageLimit": {
        "includeUsage": true
      }
    }
  }
}

Input Parameters

The input argument accepts an AddLimitV2Input object. Required fields include limitName, allowLogin, retention, maxRetention, trial, allowSelfService, allowFlightControl, dateType, and the contractual type fields. Optional fields include dailyIngest, dailyScan, expiration, userLimit, and repositoryLimit.

Returned Values

The mutation returns a non-null LimitV2! object representing the newly created limit. The returned fields include ingest quotas, storage limits, retention settings, and user access controls. The id field identifies the new limit for use in subsequent operations.