Summary

The createScheduledReport() mutation creates a scheduled report in a LogScale repository or view. A scheduled report sends a dashboard snapshot by email to a defined list of recipients on a cron-based schedule. The mutation accepts a dashboard identifier, a cron expression with a time zone, a layout configuration that controls paper size and header elements, and optional dashboard parameter overrides. Recipients receive the report without logging in to LogScale.

Syntax

graphql
createScheduledReport(
      input: CreateScheduledReportInput!
   ): ScheduledReport!

The mutation accepts a single required input argument of type CreateScheduledReportInput. The input specifies the target view name, the dashboard identifier, a recipient list, a cron-based schedule with a time zone and optional start and end dates, a layout block controlling paper size and orientation, optional dashboard parameter overrides, and optional labels. The mutation returns a non-null ScheduledReport! object representing the newly created report.

Example

Raw
graphql
mutation {
  createScheduledReport(input:
       { name: "my-report",
         viewName: "humio",
         enabled: true,
         description: "My Scheduled Report",
         dashboardId: "ILLF8JldGGP6tVspPuRtifX7ZGiHveGV",
         schedule: {cronExpression: "H 2 * * *", 
                    timeZone: "UTC+00:00", 
                    startDate: 1729781206587},
         labels: [ ]
         parameters: [ { id: "something", value: "123" }],
         layout: { paperSize: "A4", paperOrientation: "Portrait",
                   paperLayout: "List",
                   showTitleHeader: true, showDescription: true, 
                   showTitleFrontpage: true, showParameters: true,
                   showExportDate: false, footerShowPageNumbers: true,
                   maxNumberOfRows: 20 },
         recipients: [ "bob@company.com" ]
      } )
  { 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 {
  createScheduledReport(input:
       { name: \"my-report\",
         viewName: \"humio\",
         enabled: true,
         description: \"My Scheduled Report\",
         dashboardId: \"ILLF8JldGGP6tVspPuRtifX7ZGiHveGV\",
         schedule: {cronExpression: \"H 2 * * *\", 
                    timeZone: \"UTC+00:00\", 
                    startDate: 1729781206587},
         labels: [ ]
         parameters: [ { id: \"something\", value: \"123\" }],
         layout: { paperSize: \"A4\", paperOrientation: \"Portrait\",
                   paperLayout: \"List\",
                   showTitleHeader: true, showDescription: true, 
                   showTitleFrontpage: true, showParameters: true,
                   showExportDate: false, footerShowPageNumbers: true,
                   maxNumberOfRows: 20 },
         recipients: [ \"bob@company.com\" ]
      } )
  { 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 {
  createScheduledReport(input:
       { name: \"my-report\",
         viewName: \"humio\",
         enabled: true,
         description: \"My Scheduled Report\",
         dashboardId: \"ILLF8JldGGP6tVspPuRtifX7ZGiHveGV\",
         schedule: {cronExpression: \"H 2 * * *\", 
                    timeZone: \"UTC+00:00\", 
                    startDate: 1729781206587},
         labels: [ ]
         parameters: [ { id: \"something\", value: \"123\" }],
         layout: { paperSize: \"A4\", paperOrientation: \"Portrait\",
                   paperLayout: \"List\",
                   showTitleHeader: true, showDescription: true, 
                   showTitleFrontpage: true, showParameters: true,
                   showExportDate: false, footerShowPageNumbers: true,
                   maxNumberOfRows: 20 },
         recipients: [ \"bob@company.com\" ]
      } )
  { 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 { ^
  createScheduledReport(input: ^
       { name: \"my-report\", ^
         viewName: \"humio\", ^
         enabled: true, ^
         description: \"My Scheduled Report\", ^
         dashboardId: \"ILLF8JldGGP6tVspPuRtifX7ZGiHveGV\", ^
         schedule: {cronExpression: \"H 2 * * *\",  ^
                    timeZone: \"UTC+00:00\",  ^
                    startDate: 1729781206587}, ^
         labels: [ ] ^
         parameters: [ { id: \"something\", value: \"123\" }], ^
         layout: { paperSize: \"A4\", paperOrientation: \"Portrait\", ^
                   paperLayout: \"List\", ^
                   showTitleHeader: true, showDescription: true,  ^
                   showTitleFrontpage: true, showParameters: true, ^
                   showExportDate: false, footerShowPageNumbers: true, ^
                   maxNumberOfRows: 20 }, ^
         recipients: [ \"bob@company.com\" ] ^
      } ) ^
  { id } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  createScheduledReport(input:
       { name: \"my-report\",
         viewName: \"humio\",
         enabled: true,
         description: \"My Scheduled Report\",
         dashboardId: \"ILLF8JldGGP6tVspPuRtifX7ZGiHveGV\",
         schedule: {cronExpression: \"H 2 * * *\", 
                    timeZone: \"UTC+00:00\", 
                    startDate: 1729781206587},
         labels: [ ]
         parameters: [ { id: \"something\", value: \"123\" }],
         layout: { paperSize: \"A4\", paperOrientation: \"Portrait\",
                   paperLayout: \"List\",
                   showTitleHeader: true, showDescription: true, 
                   showTitleFrontpage: true, showParameters: true,
                   showExportDate: false, footerShowPageNumbers: true,
                   maxNumberOfRows: 20 },
         recipients: [ \"bob@company.com\" ]
      } )
  { 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 {
  createScheduledReport(input:
       { name: \"my-report\",
         viewName: \"humio\",
         enabled: true,
         description: \"My Scheduled Report\",
         dashboardId: \"ILLF8JldGGP6tVspPuRtifX7ZGiHveGV\",
         schedule: {cronExpression: \"H 2 * * *\", 
                    timeZone: \"UTC+00:00\", 
                    startDate: 1729781206587},
         labels: [ ]
         parameters: [ { id: \"something\", value: \"123\" }],
         layout: { paperSize: \"A4\", paperOrientation: \"Portrait\",
                   paperLayout: \"List\",
                   showTitleHeader: true, showDescription: true, 
                   showTitleFrontpage: true, showParameters: true,
                   showExportDate: false, footerShowPageNumbers: true,
                   maxNumberOfRows: 20 },
         recipients: [ \"bob@company.com\" ]
      } )
  { 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 {
  createScheduledReport(input:
       { name: \"my-report\",
         viewName: \"humio\",
         enabled: true,
         description: \"My Scheduled Report\",
         dashboardId: \"ILLF8JldGGP6tVspPuRtifX7ZGiHveGV\",
         schedule: {cronExpression: \"H 2 * * *\", 
                    timeZone: \"UTC+00:00\", 
                    startDate: 1729781206587},
         labels: [ ]
         parameters: [ { id: \"something\", value: \"123\" }],
         layout: { paperSize: \"A4\", paperOrientation: \"Portrait\",
                   paperLayout: \"List\",
                   showTitleHeader: true, showDescription: true, 
                   showTitleFrontpage: true, showParameters: true,
                   showExportDate: false, footerShowPageNumbers: true,
                   maxNumberOfRows: 20 },
         recipients: [ \"bob@company.com\" ]
      } )
  { 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 {
  createScheduledReport(input:
       { name: \"my-report\",
         viewName: \"humio\",
         enabled: true,
         description: \"My Scheduled Report\",
         dashboardId: \"ILLF8JldGGP6tVspPuRtifX7ZGiHveGV\",
         schedule: {cronExpression: \"H 2 * * *\", 
                    timeZone: \"UTC+00:00\", 
                    startDate: 1729781206587},
         labels: [ ]
         parameters: [ { id: \"something\", value: \"123\" }],
         layout: { paperSize: \"A4\", paperOrientation: \"Portrait\",
                   paperLayout: \"List\",
                   showTitleHeader: true, showDescription: true, 
                   showTitleFrontpage: true, showParameters: true,
                   showExportDate: false, footerShowPageNumbers: true,
                   maxNumberOfRows: 20 },
         recipients: [ \"bob@company.com\" ]
      } )
  { 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": {
    "createScheduledReport": {
      "id": "abc123"
    }
  }
}

Input Parameters

Provide the view name, the dashboard identifier, a recipient list, and a delivery schedule at minimum. The layout field controls paper size, paper orientation, layout mode, and which header and footer elements appear in the generated report. To retrieve a dashboard identifier, use the repository() query shown in the Related section.

Table: CreateScheduledReportInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
dashboardIdStringyes Long-Term The unique identifier of the dashboard for which the report was created.
descriptionStringyes Long-Term A description of the scheduled report.
enabledBooleanyes Long-Term Flag indicating whether the scheduled report is enabled.
labelsStringyes Long-Term Labels attached to the scheduled report.
layoutCreateScheduledReportLayoutInputyes Long-Term Layout of the scheduled report. See CreateScheduledReportLayoutInput.
nameStringyes Long-Term The name of the scheduled report.
parametersCreateScheduledReportParameterValueInputyes Long-Term A list of parameter value configurations. See CreateScheduledReportParameterValueInput.
passwordString  Long-Term The password used to protect any generated reports.
recipientsStringyes Long-Term A list of recipients who should receive an email with the generated report.
scheduleCreateScheduledReportScheduleInputyes Long-Term The schedule by which to run the report. See CreateScheduledReportScheduleInput.
timeIntervalFromString  Long-Term The start of the relative time interval for the dashboard.
viewNameStringyes Long-Term The name of the view of the scheduled report.

Returned Values

The mutation returns a ScheduledReport! object representing the newly created report. The returned object includes the report name, description, enabled status, the associated dashboard identifier, the cron-based delivery schedule with time zone and optional start and end dates, the recipient list, assigned labels, and the result of the most recent execution attempt.

Table: ScheduledReport Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
allowedActionsAssetActionyes Short-Term Allowed asset actions. This is a preview and subject to changes. See AssetAction .
createdByUser  Deprecateddeprecated in 1.306User who created the report. See User. This field is deprecated and will be removed at the earliest in version 1.306 It's replaced by createdInfo.
createdInfoAssetCommitMetadata  Long-Termadded in 1.253Metadata related to the creation of the scheduled report. See AssetCommitMetadata.
creationDateStringyes Deprecateddeprecated in 1.306The date when the report was created. This field is deprecated and will be removed at the earliest in version 1.306 It's replaced by createdInfo.
dashboardDashboard  Long-Term The dashboard for which the report was created. See Dashboard.
dashboardIdStringyes Long-Term The unique identifier of the dashboard for which the report was created.
descriptionStringyes Long-Term Description of the scheduled report.
enabledBooleanyes Long-Term Whether the scheduled report is enabled.
idStringyes Long-Term The unique identifier of the scheduled report.
isPasswordDefinedBooleanyes Long-Term Whether a password is defined for the report.
labelsStringyes Long-Term Labels attached to the scheduled report.
lastExecutionErrorsStringyes Long-Term Last errors encountered while generating the scheduled report.
lastExecutionWarningsStringyes Long-Term Last warnings encountered while generating the scheduled report.
layoutScheduledReportLayoutyes Long-Term Layout of the scheduled report. See ScheduledReportLayout.
nameStringyes Long-Term The name of the scheduled report.
packagePackageInstallation  Long-Term The package installation from which this scheduled report was created, if applicable. See PackageInstallation.
packageIdVersionedPackageSpecifier  Long-Term The versioned identifier of the package from which this scheduled report was created, in the format namespace/name@version. VersionedPackageSpecifier is a scalar.
parametersParameterValueyes Long-Term List of parameter value configurations. See ParameterValue.
recipientsStringyes Long-Term List of recipients who should receive an email with the generated report.
resourceStringyes Short-Term The resource identifier for this scheduled report.
scheduleScheduleyes Long-Term The schedule by which to run the report. See Schedule.
statusStringyes Long-Term Status of the latest report execution.
timeIntervalStartString  Long-Term Start of the relative time interval for the dashboard.
timeOfLastExecutionStartLong  Long-Term Unix timestamp for when the last execution was sent to the render service for generation.
timeOfLastReportExecutionLong  Long-Term Unix timestamp for the last report execution. The timestamp only indicates an attempt, not if it was successful.
timeOfNextPlannedReportExecutionLong  Long-Term Unix timestamp for the next planned report execution.
yamlTemplateYAMLyes Preview A YAML-formatted string that describes the scheduled report template used to create or last update this report.