Summary

The generateScheduledSearchFromTemplate() GraphQL query parses a YAML scheduled search template and returns an unsaved, in-memory UnsavedScheduledSearch object. Scheduled searches run a query on a fixed interval or cron schedule and fire actions on results — distinct from alerts, which are event-driven. Pass the result to createScheduledSearchV2() to save it.

API Stability Long-Term

Syntax

graphql
generateScheduledSearchFromTemplate(
      input: GenerateScheduledSearchFromTemplateInput!
   ): UnsavedScheduledSearch!

Provide the repository or view name as viewName and the full YAML specification of the scheduled search as yamlTemplate. Both fields are required. See Input Parameters and Returned Values for details.

Example

Raw
graphql
query {
  generateScheduledSearchFromTemplate(
    input: {viewName: "company-http", 
            yamlTemplate: "xxxx"}
  ) {
    name, 
    description,
    queryString, enabled,
    schedule, timeZone,
    actions {
      id, name, isAllowedToRun
    }    
  }
}
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" : "query {
  generateScheduledSearchFromTemplate(
    input: {viewName: \"company-http\", 
            yamlTemplate: \"xxxx\"}
  ) {
    name, 
    description,
    queryString, enabled,
    schedule, timeZone,
    actions {
      id, name, isAllowedToRun
    }    
  }
}"
}
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" : "query {
  generateScheduledSearchFromTemplate(
    input: {viewName: \"company-http\", 
            yamlTemplate: \"xxxx\"}
  ) {
    name, 
    description,
    queryString, enabled,
    schedule, timeZone,
    actions {
      id, name, isAllowedToRun
    }    
  }
}"
}
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" : "query { ^
  generateScheduledSearchFromTemplate( ^
    input: {viewName: \"company-http\",  ^
            yamlTemplate: \"xxxx\"} ^
  ) { ^
    name,  ^
    description, ^
    queryString, enabled, ^
    schedule, timeZone, ^
    actions { ^
      id, name, isAllowedToRun ^
    }     ^
  } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query {
  generateScheduledSearchFromTemplate(
    input: {viewName: \"company-http\", 
            yamlTemplate: \"xxxx\"}
  ) {
    name, 
    description,
    queryString, enabled,
    schedule, timeZone,
    actions {
      id, name, isAllowedToRun
    }    
  }
}"
}'
    "$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 = "query {
  generateScheduledSearchFromTemplate(
    input: {viewName: \"company-http\", 
            yamlTemplate: \"xxxx\"}
  ) {
    name, 
    description,
    queryString, enabled,
    schedule, timeZone,
    actions {
      id, name, isAllowedToRun
    }    
  }
}";
$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" : "query {
  generateScheduledSearchFromTemplate(
    input: {viewName: \"company-http\", 
            yamlTemplate: \"xxxx\"}
  ) {
    name, 
    description,
    queryString, enabled,
    schedule, timeZone,
    actions {
      id, name, isAllowedToRun
    }    
  }
}"
}'''

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" : "query {
  generateScheduledSearchFromTemplate(
    input: {viewName: \"company-http\", 
            yamlTemplate: \"xxxx\"}
  ) {
    name, 
    description,
    queryString, enabled,
    schedule, timeZone,
    actions {
      id, name, isAllowedToRun
    }    
  }
}"
}
);


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();

Input Parameters

Provide the repository or view name as viewName and the full YAML specification of the scheduled search as yamlTemplate. Both fields are required.

Table: GenerateScheduledSearchFromTemplateInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for the results. 
Table last updated: Oct 14, 2026 
viewNameRepoOrViewNameyes Long-Term The name of the view of the scheduled search. RepoOrViewName is a scalar.
yamlTemplateYAMLyes Long-Term The yaml specification of the scheduled search. YAML is a scalar.

Returned Values

The result is a non-nullable UnsavedScheduledSearch object. Core fields include name, description (nullable), queryString, schedule (a non-nullable string using either an interval expression such as @every 5d or a standard cron pattern), timeZone (UTC offsets only — for example, UTC, UTC-01, or UTC+12:45; named time zones are not currently supported), searchIntervalSeconds, actions (a list of Action objects to fire on query result), labels, enabled, and triggerOnEmptyResult (a non-nullable boolean — when true, actions fire even when the query returns no events, which is useful for absence monitoring such as detecting missing heartbeats).

Several fields are conditional on queryTimestampType (a non-nullable QueryTimestampType enum — either EventTimestamp or IngestTimestamp). When queryTimestampType is EventTimestamp: backfillLimitV2 (nullable Int) caps the number of missed executions that are backfilled after a shutdown, preventing overload on restart; and searchIntervalOffsetSeconds (nullable Long) shifts the query window to account for ingestion delay. When queryTimestampType is IngestTimestamp: maxWaitTimeSeconds (nullable Long) sets the maximum time to wait for late-arriving events before executing the query, balancing freshness against completeness. The available fields are listed here:

Table: UnsavedScheduledSearch Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for the results. 
Table last updated: Oct 14, 2026 
actionsActionyes Long-Term A list of unique identifiers for actions to fire on query result. See Action.
backfillLimitV2Int  Long-Term User-defined limit, which caps the number of missed searches to backfill, e.g. in the event of a shutdown. Only present when 'queryTimestampType' is EventTimestamp. Stability: Long-term
descriptionString  Long-Term A description of the scheduled search.
enabledBooleanyes Long-Term Whether the scheduled search is enabled.
labelsStringyes Long-Term Labels attached to the scheduled search.
maxWaitTimeSecondsLong  Long-Term Maximum number of seconds to wait for ingest delay. Only present when 'queryTimestampType' is IngestTimestamp. Stability: Long-term
nameStringyes Long-Term The name of the scheduled search.
queryStringStringyes Long-Term The LogScale query to execute.
queryTimestampTypeQueryTimestampTypeyes Long-Term The timestamp type to use for the query. Running on @ingesttimestamp is only available with feature flag ScheduledSearchIngestTimestamp. See QueryTimestampType.
scheduleStringyes Long-Term The cron pattern describing the schedule on which to execute the query.
searchIntervalOffsetSecondsLong  Long-Term The search interval offset in seconds when queryTimestampType is EventTimestamp.
searchIntervalSecondsLongyes Long-Term The search interval in seconds.
timeZoneStringyes Long-Term The time zone of the schedule. Currently, this field supports only UTC offsets (e.g., 'UTC', 'UTC-01' or 'UTC+12:45').
triggerOnEmptyResultBooleanyes Long-Term Whether the scheduled search should be triggered when there are no events.