Analytics CLI

How to access your analytics data with the toolkit CLI.

About this task

The toolkit CLI provides commands for viewing your analytics data, and also for configuring analytics storage settings. To view organization scoped event data, login to the toolkit CLI with provider organization's user credentials. To view cloud scoped event data and analytics storage settings, login to the toolkit CLI as the cloud admin user.

Procedure

  1. Install the toolkit: Setting up the API Connect toolkit
  2. Log in with the CLI.
    For example,
    apic login --server <platform api endpoint> --username <username> --realm <realm>
    Where,
    • <platform api endpoint> is the FQDN or base URL of your platform API endpoint, for example: platform.example.com or https://platform.example.com
    • <username> is the provider org owner. To access cloud scoped data, login as the admin user.
    • <realm> is the user registry realm for the specified <username>. By default the realm for provider organization owners is provider/default-idp-2. The realm for cloud admin users is admin/default-idp-1.
    For more information, see Toolkit CLI Login.
  3. View the available toolkit analytics commands by using -m analytics -h.
    Example
    apic -m analytics -h
    ...
    Available Commands:
    
      Creating applications and artifacts
         config                                   Manage configuration variables
    
      Publishing to the cloud
         clustermgmt                              Clustermgmt operations
         dashboards                               Dashboards operations
         events                                   Events operations
         filterparams                             Filterparams operations
    
      Other commands
         licenses                                 Review the license for API Connect
         validate                                 Validate an API or product definition
         version                                  Get the API Connect toolkit version
    ...
    
  4. View your analytics events by using the events commands.
    apic -m analytics events -h
    Type "apic [command] --help" for help on the following related commands:
          events:catalogCount  Count events at catalog scope.
          events:catalogGet    Get specific event at catalog scope.
          events:catalogList   List events at catalog scope.
          events:cloudCount    Count events at cloud scope.
          events:cloudGet      Get specific event at cloud scope.
          events:cloudList     List events at cloud scope.
          events:orgCount      Count events at organization scope.
          events:orgGet        Get specific event at organization scope.
          events:orgList       List events at organization scope.
          events:spaceCount    Count events at space scope.
          events:spaceGet      Get specific event at space scope.
          events:spaceList     List events at space scope.
    
    # To get a count of all API events at cloud level:
    apic -m analytics events:cloudCount --analytics-service <analytics service name> --server <management server api endpoint> --format=json
    {
        "total": 200
    }
    
    # To get all the cloud level events:
    apic -m analytics events:cloudList --analytics-service <analytics service name> --server <management server api endpoint> --format=json
    {
        "total": 200,
        "search_time": 7,
        "events": [
            {
                "log_policy": "activity",
    ...