Summary

The unsetRetention() mutation restores retention settings on a repository to their default values. To remove custom retention policies set with setRetention() or related mutations, call this mutation. Set each Boolean parameter to true to restore the corresponding retention type. Restore individual types selectively or restore all types in a single call.

Syntax

graphql
unsetRetention(
      repositoryName: String!,
      timeBasedRetention: Boolean = false,
      ingestSizeBasedRetention: Boolean = false,
      storageSizeBasedRetention: Boolean = false,
      timeBasedBackupRetention: Boolean = false
   ): UnsetRetentionMutation!

The repositoryName argument is required. The four Boolean arguments are optional and default to false. Set each to true to restore that retention type to its default value. The mutation returns a non-null UnsetRetentionMutation object containing fields describing the updated repository state.

Example

Raw
graphql
mutation {
  unsetRetention(
     repositoryName: "humio",
     timeBasedRetention: True,
     ingestSizeBasedRetention: True,
     storageSizeBasedRetention: False,
     timeBasedBackupRetention: True
  )  { repository { id, name } } 
}
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 {
  unsetRetention(
     repositoryName: \"humio\",
     timeBasedRetention: True,
     ingestSizeBasedRetention: True,
     storageSizeBasedRetention: False,
     timeBasedBackupRetention: True
  )  { repository { id, name } } 
}"
}
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 {
  unsetRetention(
     repositoryName: \"humio\",
     timeBasedRetention: True,
     ingestSizeBasedRetention: True,
     storageSizeBasedRetention: False,
     timeBasedBackupRetention: True
  )  { repository { id, name } } 
}"
}
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 { ^
  unsetRetention( ^
     repositoryName: \"humio\", ^
     timeBasedRetention: True, ^
     ingestSizeBasedRetention: True, ^
     storageSizeBasedRetention: False, ^
     timeBasedBackupRetention: True ^
  )  { repository { id, name } }  ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  unsetRetention(
     repositoryName: \"humio\",
     timeBasedRetention: True,
     ingestSizeBasedRetention: True,
     storageSizeBasedRetention: False,
     timeBasedBackupRetention: True
  )  { repository { id, name } } 
}"
}'
    "$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 {
  unsetRetention(
     repositoryName: \"humio\",
     timeBasedRetention: True,
     ingestSizeBasedRetention: True,
     storageSizeBasedRetention: False,
     timeBasedBackupRetention: True
  )  { repository { id, name } } 
}";
$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 {
  unsetRetention(
     repositoryName: \"humio\",
     timeBasedRetention: True,
     ingestSizeBasedRetention: True,
     storageSizeBasedRetention: False,
     timeBasedBackupRetention: True
  )  { repository { id, name } } 
}"
}'''

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 {
  unsetRetention(
     repositoryName: \"humio\",
     timeBasedRetention: True,
     ingestSizeBasedRetention: True,
     storageSizeBasedRetention: False,
     timeBasedBackupRetention: True
  )  { repository { id, name } } 
}"
}
);


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": {
    "unsetRetention": {
      "repository": {
         "id": "123abc",
         "name": "humio"
       }
    }
  }
}

Input Parameters

Provide the name of the repository whose retention settings you want to restore. Set each Boolean parameter to true to restore the corresponding retention type to its default value.

Table: Input Parameters and Datatypes

Parameter Type Required Default Description
This table includes all input parameters for this mutation.
ingestSizeBasedRetention Boolean   false Set to true to restore the ingest-size-based retention to the default value. When omitted or false, this retention type is not changed.
repositoryName String yes   The name of the repository whose retention settings you want to restore to default values.
storageSizeBasedRetention Boolean   false Set to true to restore the storage-size-based retention to the default value. When omitted or false, this retention type is not changed.
timeBasedBackupRetention Boolean   false Set to true to restore the time-based backup retention to the default value. When omitted or false, this retention type is not changed.
timeBasedRetention Boolean   false Set to true to restore the time-based retention to the default value. When omitted or false, this retention type is not changed.

Returned Values

The mutation returns an UnsetRetentionMutation object containing fields describing the updated repository state. The UnsetRetentionMutation type implements the SearchDomain interface, which provides repository metadata fields. The following tables list the available fields.

The UnsetRetentionMutation type implements the SearchDomain interface for fields describing the repository. That interface's fields are listed in the following table.