Summary

The createRepository() mutation creates a new repository in LogScale. A repository is the primary storage and search domain for ingested log data; it is immediately available for ingestion through ingest tokens after creation. Provide a unique name and any optional retention, type, or data type settings at creation time. To change the repository type or data type after creation, use updateRepositoryType() or updateRepositoryDataType().

Syntax

graphql
createRepository(
      name: String!,
      description: String,
      retentionInMillis: Long,
      retentionInIngestSizeBytes: Long,
      retentionInStorageSizeBytes: Long,
      organizationId: String,
      type: RepositoryType,
      repositoryId: String,
      dataType: RepositoryDataType,
      limitId: String
   ): CreateRepositoryMutation!

The name argument is required. All other arguments are optional. Omitting optional arguments causes LogScale to apply system defaults for retention, type, and data type.

The mutation returns a non-null CreateRepositoryMutation object containing the new repository. The returned Repository object includes an id field. Use this identifier in subsequent mutations and queries. See the Returned Values section for all available fields.

Example

Raw
graphql
mutation {
  createRepository(
        name: "my-repository",
        description: "My Repository",
        type: PERSONAL,
        dataType: ANYDATA
      )
  { repository { 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 {
  createRepository(
        name: \"my-repository\",
        description: \"My Repository\",
        type: PERSONAL,
        dataType: ANYDATA
      )
  { repository { 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 {
  createRepository(
        name: \"my-repository\",
        description: \"My Repository\",
        type: PERSONAL,
        dataType: ANYDATA
      )
  { repository { 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 { ^
  createRepository( ^
        name: \"my-repository\", ^
        description: \"My Repository\", ^
        type: PERSONAL, ^
        dataType: ANYDATA ^
      ) ^
  { repository { id } } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  createRepository(
        name: \"my-repository\",
        description: \"My Repository\",
        type: PERSONAL,
        dataType: ANYDATA
      )
  { repository { 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 {
  createRepository(
        name: \"my-repository\",
        description: \"My Repository\",
        type: PERSONAL,
        dataType: ANYDATA
      )
  { repository { 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 {
  createRepository(
        name: \"my-repository\",
        description: \"My Repository\",
        type: PERSONAL,
        dataType: ANYDATA
      )
  { repository { 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 {
  createRepository(
        name: \"my-repository\",
        description: \"My Repository\",
        type: PERSONAL,
        dataType: ANYDATA
      )
  { repository { 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();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "createRepository": {
      "repository": {
        "id": "my-repository"
      }
    }
  }
}

The limitId argument specifies the limit to attach the repository to. This is a cloud-only feature. When omitted, LogScale selects and applies a default limit.

Input Parameters

The name argument is required. All other parameters are optional. Two parameters accept enum datatypes; separate tables for those enums follow the main parameter table. When multiple retention limits are configured, LogScale enforces the first limit reached.

Table: Input Parameters and Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation. Since some of the parameters use special datatypes, additional tables for them are included below.
dataType RepositoryDataType     The category of data the repository accepts (for example, Falcon). Restricts ingestion to the specified data category. See the RepositoryDataType table below.
description string     A human-readable description of the repository's purpose. Omitting this argument leaves the description empty.
limitId string     The identifier of the ingest limit to attach to this repository. This is a cloud-only feature. When omitted, LogScale selects and applies a default limit.
name string yes   The unique name for the repository within the organization. The name appears in API paths, ingest token configurations, and search domain references.
organizationId string     The unique identifier of the organization in which to create the repository. Omit this argument to create the repository in the caller's default organization.
repositoryId string     A client-supplied identifier for the new repository. Supplying a fixed value is useful in automated provisioning workflows to produce a predictable, stable identifier. When omitted, LogScale generates a unique identifier automatically.
retentionInIngestSizeBytes long     The maximum total ingest volume to retain, in bytes. LogScale deletes data when ingested volume exceeds this limit.
retentionInMillis long     The maximum age of retained data, in milliseconds. LogScale deletes data older than this threshold.
retentionInStorageSizeBytes long     The maximum on-disk storage size to retain, in bytes. LogScale deletes data when stored volume exceeds this limit.
type RepositoryType     The repository type, which controls its purpose and access model (for example, personal or system). See the RepositoryType table below.

The RepositoryType enum specifies the repository's purpose and access model.

The RepositoryDataType enum specifies the category of data the repository accepts.

Returned Values

The mutation returns a non-null CreateRepositoryMutation object containing the new repository via its repository field. Retrieve the id field from the returned Repository object to reference the repository in subsequent mutations and queries, such as updating retention settings or deleting the repository.

Table: CreateRepositoryMutation Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
repositoryRepositoryyes Long-Term The repository to create. See Repository.

The CreateRepositoryMutation type uses the Repository datatype for repository details. The following table describes that sub-datatype:

Table: Repository Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
action(id: string): Actionmultipleyes Long-Term 

A saved action. The unique identifier of the action to get. Returns information on the action. See Action.

actions(actionIds: [string]): [Action]multipleyes Long-Term 

A list of saved actions. The result will only include actions for the specified identifiers. Omit to retrieve all actions. See Action.

aggregateAlert(id: string): AggregateAlertmultipleyes Long-Term 

A saved aggregate alert. The unique identifier of the aggregate alert. See AggregateAlert.

aggregateAlerts[AggregateAlert]yes Long-Term A list of saved aggregate alerts. See AggregateAlert.
alert(id: string): Alertmultipleyes Long-Term 

A saved alert. See Alert.

alerts[Alert]yes Long-Term Saved alerts. See Alert.
allowedViewActions[ViewAction]yes Long-Term Returns all actions the user is allowed to perform on the view. See ViewAction.
archivingConfigurationArchivingConfiguration  Short-Term Any archiving configuration. This is a preview parameter and is subject to change. See ArchivingConfiguration.
archivingProviderstring  Short-Term The archiving provider. This is a preview parameter and subject to change.
automaticSearchbooleanyes Long-Term Whether to search automatically.
availablePackages(filter: string, tags: [PackageTag], categories: [string]): [PackageRegistrySearchResultItem]multipleyes Long-Term 

Returns a list of available packages that can be installed. PackageTag is a scalar. See PackageRegistrySearchResultItem for more on it.

awsExternalIdstringyes Long-Term The AWS External unique identifier used when assuming roles in AWS on behalf of this repository.
cachePolicyCachePolicy  Preview The cache policy set on the repository. This is a preview and subject to change. See CachePolicy.
compressedByteSizelongyes Long-Term Total size of data, measured as the size after compression.
compressedByteSizeOfMergedlongyes Long-Term Total size of data, merged parts. Size is measured as the size after compression.
currentTagGroupings[TagGroupingRule]yes Long-Term Tag grouping rules applied on the repository currently. Rules only apply to the tags they denote, and tags without rules do not have any grouping. See TagGroupingRule.
dashboard(id: string): Dashboardmultipleyes Long-Term 

A saved dashboard. See Dashboard.

dashboards[Dashboard]yes Long-Term All dashboards available on the view. See Dashboard.
datasources[Datasource]yes Long-Term Data sources from where data is ingested: specific log files or services sending data to LogScale. See Datasource.
dataTypeRepositoryDataTypeyes Long-Term Repository data types are used for controlling the types of data are allowed in the repository. See RepositoryDataType.
defaultQuerySavedQuery  Long-Term The default saved query for the repository. See SavedQuery.
deletedDatelong  Long-Term The point in time the search domain was marked for deletion.
descriptionstring  Long-Term A description of the repository.
effectiveCachePolicyCachePolicyyes Preview The effective cache policy that will apply to the repository, organization or global default, in order of precedence is: the repository cache policy, if set; the organization cache policy, if set; the global cache policy, if set; or the default cache policy in which no segments are prioritized. Cache policies are a limited feature and subject to change. See CachePolicy.
eventForwardersForSelection[EventForwarderForSelection]yes Long-Term List event forwarders in the organization with only basic information. See EventForwarderForSelection.
eventForwardingRules[EventForwardingRule]yes Long-Term The event forwarding rules configured for the repository. See EventForwardingRule.
fdrFeed(id: string): FdrFeedmultipleyes Long-Term 

The unique identifier of the FDR feed to get. See FdrFeed.

fdrFeedControl(id: string): FdrFeedControlmultipleyes Long-Term 

Administrator control for an FDR feed. Provide the identifier of the FDR feed the administrator is to control. The maxNodes is the maximum number of nodes with which to poll the FDR feed. This feature is a preview and is still being iterated; changes may occur. See FdrFeedControl.

fdrFeedControls[FdrFeedControl]yes Long-Term Administrator controls for FDR feeds. This feature is still being iterated; changes may occur. See FdrFeedControl.
fdrFeeds[FdrFeed]yes Long-Term Saved FDR feeds. See FdrFeed.
fileFieldSearch(fileName: string, fieldName: string, prefixFilter: string, valueFilters: [FileFieldFilterType], fieldsToInclude: [string], maxEntries: integer): [[DictionaryEntryType]]multipleyes Long-Term 

Searching fields in a file. See FileFieldFilterType and DictionaryEntryType.

files[File]yes Long-Term Any related files. See File.
filterAlert(id: string): FilterAlertmultipleyes Long-Term 

A saved filter alert. See FilterAlert.

filterAlerts[FilterAlert]yes Long-Term Saved filter alerts. See FilterAlert.
gcsArchivingConfigurationGCSArchivingConfiguration  Short-Term GCS archiving configuration. This is a preview and subject to change. See GCSArchivingConfiguration.
groups[Group]yes Long-Term Groups with assigned roles. See Group.
hasPackageInstalled(packageId: VersionedPackageSpecifier): booleanmultipleyes Long-Term 

Whether the repository has a given package installed. VersionedPackageSpecifier is a scalar.

idstringyes Long-Term The unique identifier of the repository.
ingestBlockdatetime  Long-Term The date and time in the future after which ingest for this repository will be re-enabled.
ingestFeed(id: string): IngestFeedmultipleyes Long-Term 

A saved Ingest feed. See IngestFeed.

ingestFeeds(searchFilter: string, typeFilter: [IngestFeeds__Type], sortBy: IngestFeeds__SortBy, orderBy: OrderBy, skip: integer, limit: integer): IngestFeedQueryResultSet!multipleyes Long-Term 

Saved Ingest feeds. See IngestFeeds__Type, IngestFeeds__SortBy, OrderBy, and IngestFeedQueryResultSet.

ingestListeners[IngestListener]yes Long-Term The ingest listeners configured for this repository (see IngestListener).
ingestSizeBasedRetentionfloat  Long-Term Retention in gigabytes, based on the size of data when it arrives at LogScale, before parsing and compression. LogScale will keep at most this amount of data.
ingestTokens[IngestToken]yes Long-Term The ingest token used for receiving data into the repository. See IngestToken.
installedPackages[PackageInstallation]yes Long-Term List packages installed on a specific view or repository. See PackageInstallation.
interactions[ViewInteraction]yes Long-Term All interactions defined on the view. See ViewInteraction.
isActionAllowed(action: ViewAction): booleanmultipleyes Long-Term 

Check if the current user is allowed to perform the given action on the view. See ViewAction.

isStarredbooleanyes Long-Term Whether the repository is marked with a star.
limitLimitV2  Long-Term This is the limit attached to the repository. See LimitV2.
maxAutoShardCountinteger  Long-Term The maximum number of auto shards created.
nameRepoOrViewNameyes Long-Term The name of the repository. RepoOrViewName is a scalar.
packageV2(packageId: VersionedPackageSpecifier): Package2multipleyes Long-Term 

The returned package information for the specified package. VersionedPackageSpecifier is a scalar. See Package2.

packageVersions(packageId: UnversionedPackageSpecifier): [RegistryPackageVersionInfo]multipleyes Long-Term 

The available versions of a package. UnversionedPackageSpecifier is a scalar. See RegistryPackageVersionInfo.

parser(parserid: string, name: string): Parsermultiple  Long-Term 

The parser for the repository. Give either the parserid or the name. See Parser.

parsers[Parser]yes Long-Term List of parsers used with the repository. See Parser.
permanentlyDeletedAtlong  Long-Term The point in time the search domain will not be restorable.
persistedAggregations(sortBy: PersistedAggregationSortBy, orderBy: OrderBy, skip: integer, limit: integer): PersistedAggregationResultSetmultiple  Preview 

List of persisted aggregations for repository, with sorting and pagination. See PersistedAggregationSortBy.

recentQueriesV2[RecentQuery]yes Long-Term Any recent queries. See RecentQuery.
redirectQueryAssetLookupToSearchDomain  Preview The redirected query asset lookup view used for asset resolution when set. Assets like saved queries and lookup files will be resolved from this view instead of the current view. See SearchDomain.
reposExcludedInSearchLimit[string]yes Long-Term Repositories not part of the search limitation.
resourcestring  Short-Term The resource identifier for this search domain.
s3ArchivingArnstring  Short-Term The ARN of the AWS IAM identity that will write to S3 for S3 archiving.
s3ArchivingConfigurationS3Configuration  Long-Term The configuration for S3 archiving (e.g., bucket name and region). See S3Configuration.
savedQueries[SavedQuery]yes Long-Term Saved queries. See SavedQuery.
savedQuery(id: string): SavedQuerymultipleyes Long-Term 

A saved query. See SavedQuery.

scheduledReport(id: string): ScheduledReportmultipleyes Long-Term 

Saved scheduled report. See ScheduledReport.

scheduledReports[ScheduledReport]yes Long-Term Saved scheduled reports. See ScheduledReport.
scheduledSearch(id: string): ScheduledSearchmultipleyes Long-Term 

A saved scheduled search. See ScheduledSearch.

scheduledSearches[ScheduledSearch]yes Long-Term Saved scheduled searches. See ScheduledSearch.
searchLimitedMslong  Long-Term Search limit in milliseconds, to which searches should are limited.
secretHandle(id: string): SecretHandlemultipleyes Preview 

A saved secret handle. See SecretHandle.

secretHandles(skip: integer, limit: integer): secretHandleQueryResultSetmultipleyes Preview 

Saved secret handles. See secretHandleQueryResultSet.

starredFields[string]yes Long-Term A list of fields which are marked with a star in the repository.
storageSizeBasedRetentionfloat  Long-Term Retention in gigabytes, based on the size of data when in storage, after parsing and compression. LogScale will keep at least this amount of data, but as close to this amount as possible.
tags[string]yes Long-Term All tags from all datasources.
timeBasedBackupRetentionfloat  Long-Term Sets time in days to keep back-ups before they are deleted.
timeBasedRetentionfloat  Long-Term The maximum time in days to keep data. Older date will be deleted.
timeOfLatestIngestdatetime  Long-Term The timestamp of the latest ingested data, or null if the repository is empty.
typeRepositoryTypeyes Long-Term Repository Types are used for tracking trial status in LogScale Cloud setups. See RepositoryType.
uncompressedByteSizelongyes Long-Term Total size the data, measured as the size stored before compression and is thus the size of the internal format, not the data that was ingested.
uncompressedByteSizeOfMergedlongyes Long-Term Total size the data, merged parts. Size is measured as the size stored before compression and is thus the size of the internal format, not the data that was ingested.
usageTagstring  Long-Term The usage tag used to group usage summary on repositories.
users[User]yes Long-Term Users who have access to the repository. See User.
usersAndGroups(search: string, skip: integer, limit: integer): UsersAndGroupsSearchResultSetmultipleyes Long-Term 

Users or groups who have access to the repository. See UsersAndGroupsSearchResultSet.

usersV2(search: string, permissionFilter: Permission, skip: integer, limit: integer): Usersmultipleyes Short-Term 

Used to search for a user based on search parameters and for a given permission. See Permission and Users.

viewerQueryPrefixstringyes Long-Term The query prefix prepended to each search in this domain.