usage_reports
Creates, updates, deletes, gets or lists a usage_reports resource.
Overview​
| Name | usage_reports |
| Type | Resource |
| Id | sumologic.account.usage_reports |
Fields​
The following fields are returned by SELECT queries:
- get
Status response containing status and downloadURL if successful.
| Name | Datatype | Description |
|---|---|---|
code | string | An error code describing the type of error. (example: auth:password_too_short) |
detail | string | An 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.) |
message | string | A short English-language description of the error. (example: Your password was too short.) |
meta | string | An optional list of metadata about the error. (opaque JSON object) |
report_download_url | string | S3 presigned download URL for the report. It is valid for 10 minutes. (example: www.example.com) (wire: reportDownloadURL) |
status | string | Status export (pattern: <code>^(Success|InProgress|Failed)$</code>, example: Success) |
status_message | string | Status message export (example: Successful request) (wire: statusMessage) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | job_id, region | Get the report download URL and status using Job Id. | |
create | insert | region | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
job_id | string | Job Id for the report to be exported. (wire: jobId) |
region | string | Sumo 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
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​
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: usage_reports
props:
- name: region
value: "{{ region }}"
description: Required parameter for the usage_reports resource.
- name: start_date
value: "{{ start_date }}"
description: |
Start date, without the time, of the usage data to fetch. If no value is provided startDate is used as the start of the subscription. The start date cannot be before the start of the subscription.
- name: end_date
value: "{{ end_date }}"
description: |
End date, without the time, of usage data to fetch. If no value is provided endDate is used as the end of the subscription. The end date cannot be after the end of the subscription.
- name: group_by
value: "{{ group_by }}"
description: |
Perform a groupBy operation on the usage details. If no value is provided data is grouped by `Day` - `day`: Aggregate the data by day - `week`: Aggregate the data by week. Week starts at Monday and ends at sunday night. - `month`: Aggregate the data by calendar month.
default: day
- name: report_type
value: "{{ report_type }}"
description: |
Specifies the type of report to be exported. Available types are `standard` and `detailed`. An additional `childDetailed` type is available for Sumo Orgs parents. Detailed report will have raw consumption along with the credits breakdown. If no value is provided Standard reports will be exported.
default: standard
- name: include_deployment_charge
value: {{ include_deployment_charge }}
description: |
Deployment charges will be applied to the returned usages csv if this is set to true and the organization is a part of Sumo Organizations as a child organization.
default: false