Skip to main content

usage_reports

Creates, updates, deletes, gets or lists a usage_reports resource.

Overview​

Nameusage_reports
TypeResource
Idsumologic.account.usage_reports

Fields​

The following fields are returned by SELECT queries:

Status response containing status and downloadURL if successful.

NameDatatypeDescription
codestringAn error code describing the type of error. (example: auth:password_too_short)
detailstringAn optional fuller English-language description of the error. (example: Your password was 5 characters long, the minimum length is 12 characters. See http:​//example.com/password for more information.)
messagestringA short English-language description of the error. (example: Your password was too short.)
metastringAn optional list of metadata about the error. (opaque JSON object)
report_download_urlstringS3 presigned download URL for the report. It is valid for 10 minutes. (example: www.example.com) (wire: reportDownloadURL)
statusstringStatus export (pattern: <code>^(Success|InProgress|Failed)$</code>, example: Success)
status_messagestringStatus message export (example: Successful request) (wire: statusMessage)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectjob_id, regionGet the report download URL and status using Job Id.
createinsertregionExport the credit usage details as csv for the specific period of time given as input in the form of a start and end date with a specific grouping according to day, week, month, Note that this API will work only for credits plan customers.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
job_idstringJob Id for the report to be exported. (wire: jobId)
regionstringSumo Logic deployment (au, ca, ch, de, eu, fed, in, jp, kr, us1, us2). Resolved from the SUMOLOGIC_ENVIRONMENT environment variable when it is set (x-stackQL-envVar, the same variable the Terraform provider reads); otherwise defaults to us2. A WHERE region = '...' value always takes precedence. (enum: [au, ca, ch, de, eu, fed, in, jp, kr, us1, us2], default: us2, x-stackQL-envVar: SUMOLOGIC_ENVIRONMENT)

SELECT examples​

Get the report download URL and status using Job Id.

SELECT
code,
detail,
message,
meta,
report_download_url,
status,
status_message
FROM sumologic.account.usage_reports
WHERE job_id = '{{ job_id }}' -- required
AND region = '{{ region }}' -- required unless SUMOLOGIC_ENVIRONMENT is set
;

INSERT examples​

Export the credit usage details as csv for the specific period of time given as input in the form of a start and end date with a specific grouping according to day, week, month, Note that this API will work only for credits plan customers.

INSERT INTO sumologic.account.usage_reports (
start_date,
end_date,
group_by,
report_type,
include_deployment_charge,
region
)
SELECT
'{{ start_date }}',
'{{ end_date }}',
'{{ group_by }}',
'{{ report_type }}',
{{ include_deployment_charge }},
'{{ region }}'
RETURNING
job_id
;