Accessing analytics data with the toolkit CLI

You can access your analytics event data by using the API Connect 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 using provider organization 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 to the Management server: Toolkit CLI Login.
    apic login --server <management_hostname/api_base_url> --username <username> --realm <realm>
    Where:
    • <management_hostname/api_base_url> is the FQDN or base URL of your management API endpoints, for example: mgmt.example.com or https://mgmt.example.com
    • <username> is either the admin user or provider org owner, depending on whether you want to access cloud or provider organization scoped analytics data.
    • <realm> is the user registry realm for the specified <username>. By default this is admin/default-idp-1 for the admin user, and provider/default-idp-2 for provider organization users.
  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 APIConnect 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",
    ...