Stability Level Long-Term

As an extra feature for assisting you with administering scheduled searches, you can attach labels to them. You can add them when creating a scheduled search, or later with the addScheduledSearchLabels() GraphQL mutation. There can be at most ten labels per saved query, with a maximum length of sixty characters per label.

When you execute this mutation, it will return information on the updated scheduled search, if successful — null with errors, if not. The return values can include all of the labels for the scheduled search — the ones added and saved previously. From that list you may choose to delete some labels. Use the removeScheduledSearchLabels() mutation to do that.

Hide Query Example

Show Scheduled Search Labels Query

For more information on scheduled searches, see the Scheduled searches documentation page. To manage labels through the UI, see the Triggers and Manage Triggers pages of the main documentation.

Syntax

graphql
addScheduledSearchLabels(
      input: AddScheduledSearchLabels!
   ): ScheduledSearch

For the input, you have to give the name of the view or repository, and the unique identifier of the scheduled search to which you want to add labels (click on Show Query below). And, you'll have to provide within brackets, a comma-separated list of labels.

For the return datatype for this mutation, you can get details on the scheduled search, including a list of labels for it. See the Returned Datatype section farther down this page.

Hide Query Example

Show Scheduled Search Identifiers Query

Example

Raw
graphql
mutation {
  addScheduledSearchLabels(input: 
       { viewName: "humio", 
         id: "abc123", 
         labels: [ "find-them-1",
                   "admin-focus" ] 
        } 
    )
  { name, description, enabled, runAsUser { id, username } }
}
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 {
  addScheduledSearchLabels(input: 
       { viewName: \"humio\", 
         id: \"abc123\", 
         labels: [ \"find-them-1\",
                   \"admin-focus\" ] 
        } 
    )
  { name, description, enabled, runAsUser { id, username } }
}"
}
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 {
  addScheduledSearchLabels(input: 
       { viewName: \"humio\", 
         id: \"abc123\", 
         labels: [ \"find-them-1\",
                   \"admin-focus\" ] 
        } 
    )
  { name, description, enabled, runAsUser { id, username } }
}"
}
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 { ^
  addScheduledSearchLabels(input:  ^
       { viewName: \"humio\",  ^
         id: \"abc123\",  ^
         labels: [ \"find-them-1\", ^
                   \"admin-focus\" ]  ^
        }  ^
    ) ^
  { name, description, enabled, runAsUser { id, username } } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  addScheduledSearchLabels(input: 
       { viewName: \"humio\", 
         id: \"abc123\", 
         labels: [ \"find-them-1\",
                   \"admin-focus\" ] 
        } 
    )
  { name, description, enabled, runAsUser { id, username } }
}"
}'
    "$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 {
  addScheduledSearchLabels(input: 
       { viewName: \"humio\", 
         id: \"abc123\", 
         labels: [ \"find-them-1\",
                   \"admin-focus\" ] 
        } 
    )
  { name, description, enabled, runAsUser { id, username } }
}";
$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 {
  addScheduledSearchLabels(input: 
       { viewName: \"humio\", 
         id: \"abc123\", 
         labels: [ \"find-them-1\",
                   \"admin-focus\" ] 
        } 
    )
  { name, description, enabled, runAsUser { id, username } }
}"
}'''

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 {
  addScheduledSearchLabels(input: 
       { viewName: \"humio\", 
         id: \"abc123\", 
         labels: [ \"find-them-1\",
                   \"admin-focus\" ] 
        } 
    )
  { name, description, enabled, runAsUser { id, username } }
}"
}
);


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": {
    "addScheduledSearchLabels": {
      "name": "Seeker",
      "description": "Searching for locals.",
      "enabled": true,
      "runAsUser": {
        "id": "def456",
        "username": "bob@company.com"
      }
    }
  }
}

Given Datatype

You'll have to give the view or repository name, and the unique identifier of the schedule search to which you want to add labels — and a comma-separated list of labels to add, within square-brackets. This is described here in the table for this datatype. Click on the Show Query link under the Syntax section above for an example of how to get the scheduled search identifiers.

Table: AddScheduledSearchLabels

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Nov 14, 2025
idstringyes Long-TermThe unique identifier of a scheduled search.
labels[string]yes Long-TermLabels to add to a scheduled search, at most one-hundred at a time.
viewNameRepoOrViewNameyes Long-TermThe name of the view of a scheduled search. RepoOrViewName is a scalar.

Returned Datatype

You can get the query string used by the scheduled search, what actions are triggered, and any errors or warnings when it was last executed. Related more specifically to this mutation, you can use the labels parameter to get a list of labels associated with the search in case you want to remove some or add more. These and other parameters are listed in the table below, along with links to related datatype tables.

Table: ScheduledSearch

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Mar 27, 2026
actions[string]yes Long-TermList of unique identifiers for actions to fire on query result.
actionsV2[Action]yes Long-TermList of actions to fire on query result. See Action.
allowedActions[AssetAction]yes Short-TermThe allowed asset actions. See AssetAction .
backfillLimitV2integer  Long-TermUser-defined limit, which caps the number of missed searches to backfill when queryTimestampType is EventTimestamp.
createdInfoAssetCommitMetadata  Long-TermMetadata related to the creation of the scheduled search. See AssetCommitMetadata.
descriptionstring  Long-TermA description of the scheduled search.
enabledbooleanyes Long-TermWhether the scheduled search is enabled.
executionTimesToRerun[long]yes Long-TermExecution times of the scheduled search runs to rerun as Unix timestamp in milliseconds.
idstringyes Long-TermThe unique identifier of the scheduled search.
labels[string]yes Long-TermThe labels added to the scheduled search.
lastErrorstring  Long-TermThe last error encountered while running the search.
lastExecutedlong  DeprecatedUnix timestamp for end of search interval for last query execution. However, this parameter has been deprecated because the name is confusing. It will be removed at the earliest in version 1.27. Use instead the timeOfLastExecution parameter.
lastTriggeredlong  DeprecatedUnix timestamp for end of search interval for last query execution that triggered. However, this parameter has been deprecated because the name is confusing. It will be removed at the earliest in version 1.27. Use instead the timeOfLastTrigger parameter.
lastWarnings[string]yes Long-TermThe Last warnings encountered while running the scheduled search.
maxWaitTimeSecondslong  Long-TermThe maximum wait time in seconds when queryTimestampType is IngestTimestamp.
modifiedInfoModifiedInfoyes PreviewUser or token used to modify the asset. See ModifiedInfo.
namestringyes Long-TermThe name of the scheduled search.
packagePackageInstallation  Long-TermThe related package. See PackageInstallation.
packageIdVersionedPackageSpecifier  Long-TermThe unique identifier for the related package. VersionedPackageSpecifier is a scalar.
queryOwnershipQueryOwnershipyes Long-TermOwnership of the query run by this scheduled search. See QueryOwnership.
queryStringstringyes Long-TermThe LogScale query to execute.
queryTimestampTypeQueryTimestampTypeyes Long-TermThe timestamp type to use for the query. Running on @ingesttimestamp is only available with feature flag ScheduledSearchIngestTimestamp. See QueryTimestampType .
resourcestringyes Short-TermThe resource identifier for the scheduled search.
runAsUserUser  Long-TermThe unique identifier of the user as which the scheduled search is running. See User.
schedulestringyes Long-TermThe cron pattern describing the schedule to execute the query on.
searchIntervalOffsetSecondslong  Long-TermThe search interval offset in seconds when queryTimestampType is EventTimestamp.
searchIntervalSecondslongyes Long-TermThe search interval in seconds.
timeOfLastExecutionlong  Long-TermUnix timestamp for when the scheduled search was last executed.
timeOfLastTriggerlong  Long-TermUnix timestamp for when the scheduled search was last triggered.
timeOfNextPlannedExecutionlong  Long-TermThe UNIX timestamp for next planned search.
timeZonestringyes Long-TermTime zone of the schedule. Currently, this field only supports UTC offsets like 'UTC', 'UTC-01' or 'UTC+12:45'.
triggerOnEmptyResultbooleanyes Long-TermFlag indicating whether the scheduled search should trigger when it finds an empty result (i.e., no events).
yamlTemplateYAMLyes Long-TermA template that can be used to recreate the scheduled search. YAML is a scalar.