IBM Cloud Docs
IBM Cloud Logs CLI

IBM Cloud Logs CLI

You can use the IBM® Cloud Logs command-line interface (CLI) to manage your IBM Cloud Logs instance.

Prerequisites

  • Install the IBM Cloud CLI.

  • Install the IBM Cloud Logs CLI plug-in by running the following command:

    ibmcloud plugin install logs
    

    You're notified on the command line when updates to the IBM Cloud CLI and plug-ins are available. Be sure to keep your CLI up to date so that you can use the latest commands. You can view the current version of all installed plug-ins by running ibmcloud plugin list.

  • To target the IBM Cloud Logs instance, use one of the following options.

    Option 1: Run the ibmcloud logs config set command.

    ibmcloud logs config set service-url https://{API_endpoint}
    

    Option 2: Export an environment variable with your IBM Cloud Logs service endpoint URL.

    export LOGS_URL=https://{API_endpoint}
    

    Option 3: Set the service endpoint in the command.

    ibmcloud logs --service-url https://{API_endpoint}
    

    Replace {API_endpoint} with the API endpoint that is specific to your instance. The API endpoint information can be copied from the service details page in the IBM Cloud Logs UI.

Commands

The currently supported version of the IBM Cloud Logs CLI is 0.3.0. If any other version is installed, uninstall the plug-in that is installed and install the current IBM Cloud Logs CLI plug-in.

Both ibmcloud cloud-logs and ibmcloud logs can be used to run IBM Cloud Logs CLI commands.

IBM Cloud Logs alert CLI commands
Command Description
alert Get an alert by ID.
alert-create Create an alert.
alert-delete Delete an alert.
alert-update Update an alert.
alerts List alerts.
IBM Cloud Logs alert definition CLI commands
Command Description
alert-definition Get an alert definition by ID.
alert-definition-create Create an alert definition.
alert-definition-delete Delete an alert definition by ID.
alert-definition-update Update an alert definition by ID.
alert-definitions List alert definitions.
IBM Cloud Logs background query (asynchronous archive query) CLI commands
Command Description
background-query-cancel, bgq-cancel Cancel a background query.
background-query-create, bgq-create Submit a background query to be processed asynchronously.
background-query-data, bgq-data Data of the background query to search the logs.
background-query-status, bgq-status Get the status of a background query.
IBM Cloud Logs data access rule CLI commands
Command Description
data-access-rule-create Create a data access rule.
data-access-rule-delete Delete a data access rule.
data-access-rule-update Update a data access rule.
data-access-rules Get a service instance's data access rules by ID.
IBM Cloud Logs data usage CLI commands
Command Description
data-usage Get the daily and detailed data usage.
data-usage-metrics-export-status Get the data usage metrics export status.
data-usage-metrics-export-status-update Update the data usage metrics export status.
IBM Cloud Logs enrichment CLI commands
Command Description
enrichment-create Create an enrichment.
enrichment-delete Delete enrichments.
enrichments List all enrichments.
IBM Cloud Logs Event Streams integration CLI commands
Command Description
event-stream-target-create Create an IBM Event Streams for IBM Cloud integration.
event-stream-target-delete Delete an Event Streams integration by ID.
event-stream-target-update Update an Event Streams integration.
event-stream-targets List all Event Streams integrations.
IBM Cloud Logs events to metrics CLI commands
Command Description
events2metrics, e2m Gets the events to metrics definitions by ID.
events2metrics-create, e2m-create Creates the events to metrics definitions.
events2metrics-delete, e2m-delete Deletes the events to metrics definitions by ID.
events2metrics-list, e2m-list Lists the events to metrics definitions.
events2metrics-update, e2m-update Updates the events to metrics definitions.
IBM Cloud Logs outbound integration CLI commands
Command Description
outgoing-webhook Gets an outbound integration by ID.
outgoing-webhook-create Create an outbound integration.
outgoing-webhook-delete Delete an outbound integration.
outgoing-webhook-update Update an outbound integration.
outgoing-webhooks List outbound integrations.
IBM Cloud Logs policy CLI commands
Command Description
policies Gets policies.
policy Gets a policy by ID.
policy-create Creates a new policy.
policy-delete Deletes an existing policy.
policy-update Updates an existing policy.
IBM Cloud Logs query CLI commands
Command Description
query Run a query to search the logs.
IBM Cloud Logs rules CLI commands
Command Description
rule-group Gets a rule group by groupid.
rule-group-create Creates a rule group.
rule-group-delete Deletes a rule group by groupid.
rule-group-update Updates a rule group by groupid.
rule-groups Gets all rule groups.
IBM Cloud Logs view CLI commands
Command Description
view Gets a view by ID.
view-create Creates a new view.
view-delete Deletes a view by ID.
view-update Replaces an existing view.
views Lists all public views.
IBM Cloud Logs view folder CLI commands
Command Description
view-folder Get a view folder.
view-folder-create Create a view folder.
view-folder-delete Deletes a view folder by ID.
view-folder-update Replaces an existing view folder.
view-folders List a view's folders.
IBM Cloud Logs additional CLI commands
Command Description
config Control the persistent configuration.
help Show help information.

For more information about using these commands, log in to the IBM Cloud and run ibmcloud logs command_name -h. For example, ibmcloud logs views -h.