Summary

LogScale packages can bundle scheduled report templates alongside dashboards, parsers, and actions. These templates define the report schedule, layout, and dashboard association so that report configuration ships as part of the package rather than requiring manual setup after installation.

The createScheduledReportFromPackageTemplate() mutation creates a scheduled report in a repository or view by instantiating a named template from an installed package. Provide the packageId of the installed package, the templateName of the report template within that package, and the viewName of the target repository or view. The optional overrideName field lets you assign a custom display name; if omitted, the name defined in the template is used. The mutation returns a non-null ScheduledReport! object for the newly created report.

To create a scheduled report from a YAML template instead, use createScheduledReportFromTemplate().

Syntax

graphql
createScheduledReportFromPackageTemplate(
      input: CreateScheduledReportFromPackageTemplateInput!
   ): ScheduledReport!

The input argument is required and takes a CreateScheduledReportFromPackageTemplateInput object. Three fields are required: packageId (a VersionedPackageSpecifier scalar in the format namespace/name@version, for example crowdstrike/logscale-slack@1.0.0), templateName (the name of the report template within the package), and viewName (the name of the target repository or view). The optional overrideName field sets a custom display name for the new report.

The mutation returns a non-null ScheduledReport! object for the newly created report. The Returned Values section lists the available fields, including id, name, schedule, and status.

Example

Raw
graphql
mutation {
  createScheduledReportFromPackageTemplate(
    input: { viewName: "our_view", 
             packageId: "crowdstrike/logscale-slack@1.0.0",
             "templateName": "something" }
  ) { 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 {
  createScheduledReportFromPackageTemplate(
    input: { viewName: \"our_view\", 
             packageId: \"crowdstrike/logscale-slack@1.0.0\",
             \"templateName\": \"something\" }
  ) { 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 {
  createScheduledReportFromPackageTemplate(
    input: { viewName: \"our_view\", 
             packageId: \"crowdstrike/logscale-slack@1.0.0\",
             \"templateName\": \"something\" }
  ) { 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 { ^
  createScheduledReportFromPackageTemplate( ^
    input: { viewName: \"our_view\",  ^
             packageId: \"crowdstrike/logscale-slack@1.0.0\", ^
             \"templateName\": \"something\" } ^
  ) { id } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  createScheduledReportFromPackageTemplate(
    input: { viewName: \"our_view\", 
             packageId: \"crowdstrike/logscale-slack@1.0.0\",
             \"templateName\": \"something\" }
  ) { 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 {
  createScheduledReportFromPackageTemplate(
    input: { viewName: \"our_view\", 
             packageId: \"crowdstrike/logscale-slack@1.0.0\",
             \"templateName\": \"something\" }
  ) { 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 {
  createScheduledReportFromPackageTemplate(
    input: { viewName: \"our_view\", 
             packageId: \"crowdstrike/logscale-slack@1.0.0\",
             \"templateName\": \"something\" }
  ) { 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 {
  createScheduledReportFromPackageTemplate(
    input: { viewName: \"our_view\", 
             packageId: \"crowdstrike/logscale-slack@1.0.0\",
             \"templateName\": \"something\" }
  ) { 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": {
    "createScheduledReportFromPackageTemplate": {
      "id": "123abc"
    }
  }
}

Input Parameters

Provide the versioned package identifier, the template name within the package, and the target repository or view name. Use the optional overrideName field to assign a display name different from the one defined in the template. The following table lists all fields of CreateScheduledReportFromPackageTemplateInput:

Returned Values

The mutation returns a non-null ScheduledReport! object representing the newly created report. Include id to capture the report identifier for subsequent updates or deletions. Include name, schedule, and status to confirm the schedule and execution state inherited from the package template. The following table lists all available fields: