Generating detailed usage reports
In IBM Cloud Logs, you can export a Data Usage Report as CSV, TSV or JSON. The report provides an overview of your instance's data usage for the current month, the previous 30 days, or the previous 90 days.
You can generate a report for:
- The current month
- Last 30 days
- Last 90 days
Prereqs
- You must configure a metrics bucket..
- You must enable the data usage feature. For more information, see Enabling data usage metrics.
Information included in a report
The detailed usage report includes the following information per application, subsystem, severity, priority, TCO policy, and type:
- Date
- Total Data Sent(GB)
Generating a report
Complete the following steps to export the Data Usage Report as a CSV file:
-
Navigate to your IBM Cloud Logs instance: Observability > Logging > Cloud Logs > Your Service Instance > Open Dashboard.
-
Select the Usage icon
> Data Usage.
The Data Usage page opens.
-
Select Detailed report for the Data Usage Report type.
-
Select the date range.
-
Choose the export format.
Valid values are:
CSV,TSV, andJSON.Use
CSV, andTSVto manage data through spreadsheets.Use
JSONto manage data through automated integrations. -
For export formats
CSVandTSV, select whether you want to include headers in the report. When selected, column names will be added as first row of the exported file. -
Click Export.
Exporting a detailed data usage report using API
You can export a detailed data usage report programmatically by calling the IBM Cloud Logs API.
The following example shows a query that you can use to export the detailed data usage report. When you call the API, replace the ID variables and IAM token with the values that are specific to your IBM Cloud Logs instance.
Detailed data usage reports are exported using the query query parameter with value detailed.
You can retrieve the detailed data usage report for a specified time range for your IBM Cloud Logs instance with range request parameters. Valid values for the range parameter are current_month, last_30_days,
last_90_days, and last_week. The default is current_month.
curl 'https://{instance_ID}.api.{region}.logs.cloud.ibm.com/v1/data_usage?query=detailed&&range=last_30_days' \
-H 'Authorization: Bearer {iam_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
A successful response returns the detailed data usage report for the specified time range. For more information about the API, see Get data usage metrics export status or return data usage report.
Exporting the detailed data usage report using CLI
Before you begin, follow the steps to set your IBM Cloud Logs instance API endpoint.
To export the detailed data usage report by using the IBM Cloud Logs CLI plug-in, run the ibmcloud logs data-usage command. For example, the following command exports the data usage detailed report for last 30 days.
ibmcloud logs data-usage --query detailed --range last_30_days
Detailed data usage reports are exported using query parameter with value detailed.
You can retrieve the detailed data usage report over a specified time range for your IBM Cloud Logs instance with range request parameters. Valid values of the range parameter are current_month, last_30_days,
last_90_days, and last_week. The default is current_month.
A successful command returns the detailed data usage report for the specified time range.