Contact Us 1-800-596-4880

Manage Mule API Analytics Reports

Mule API Analytics reports let you download API event data in CSV or JSON format for selected APIs, versions, environments, and time windows. The service retains about one month of data, can lag up to ten minutes, and throttles callers to ten requests per minute with a twenty-thousand-event cap per request. It suits ad hoc analysis instead of bulk export or continuous synchronization. For reliable delivery of event data into another system, see Forward Mule API Analytics Events to External Systems.

Access Mule API Analytics

You can access Mule API Analytics from Anypoint Monitoring or API Manager.

To open Mule API Analytics from Anypoint Monitoring:

  1. Go to Anypoint Platform > Anypoint Monitoring.

  2. In the left navigation, select Mule API Analytics.

To open Mule API Analytics from API Manager:

  1. Go to Anypoint Platform > API Manager.

  2. In the left navigation, select Mule API Analytics.

Create a Report

Mule API Analytics reports identify API events such as policy violations from rate limiting or IP filtering. If the analytics service or Anypoint Platform is temporarily unavailable, Anypoint Platform may submit multiple data points to avoid telemetry data loss, which can cause a report to contain duplicate entries.

  1. From the Mule API Analytics page, select an environment from the Environment dropdown menu.

  2. Click New.

  3. In the Create report window, complete these fields:

    Field Description

    Title

    A name for the report. Required. Maximum 100 characters.

    Data Source

    The API to report on. Select All APIs to include all APIs in the organization, or choose a specific API by name.

    API Version / Instance

    The API version or instance to include. Available only when you select a specific API in Data Source.

    Date Range

    The time window for the report. Options: 1 Hour, 3 Hours, 1 Day, 1 Week (default), 30 days, or Custom. When you select Custom, enter a Start and End date and time.

    Format

    Output format: CSV (default) or JSON.

    Fields

    The event fields to include in the report. Required. Click Select all fields to add all available fields, or use the dropdown to add individual fields. See Report Data Fields Reference.

    The URL field updates automatically as you make selections and shows the API endpoint that will be called when you run the report.

  4. Click Save to save the report, or Run to download the report immediately without saving.

Run a Saved Report

The Mule API Analytics report list shows the name and URL endpoint for each saved report.

  1. From the Mule API Analytics page, select the environment where the report was created.

    Reports are stored per environment. A report created in the Sandbox environment does not appear in Production.

  2. Click Run next to the report to download.

    The report downloads as a CSV or JSON file named after the report title.

The Analytics Event API displays the start time data is available from. If no data exists for the selected range, a warning message appears.

Edit a Report

To edit a Mule API Analytics report:

  1. From the Mule API Analytics page, click the report name.

  2. In the Edit report window, update the date range, format, or fields as needed.

    You can’t change the Title or Data Source after saving. To change those, delete the report and create a new one.
  3. Click Save, or click Run to download the report with the updated settings without saving.

Delete a Report

To delete a saved Mule API Analytics report:

  1. From the Mule API Analytics page, click Delete next to the report you want to remove.

  2. In the confirmation window, click Delete to confirm, or Cancel to return to the report list.

Search for a Report

Use the Find reports by name search field to filter by the name of the Mule API Analytics report.

Analytics Events API Limits and Best Practices

The Analytics Events API enforces these limits:

  • One-month data retention

  • Data availability delay of up to 10 minutes

  • Maximum 10 requests per minute (requests above this rate are throttled)

  • Maximum 20,000 events per request

Before you use the Analytics Events API programmatically, review these requirements:

  • Don’t allow calls to overlap time intervals.

  • Don’t repeat the same request for every API that you have.

  • Although the Analytics Events API enforces a limit of 10 requests per minute, the best practice is 1 request per minute.

  • Don’t use the Analytics Events API for data synchronization.

    To synchronize event data with an external system, see Forward Mule API Analytics Events to External Systems.

View Report Output with Curl

The URL field in the Create or Edit report window shows the endpoint you can call directly with an access token.

To retrieve the access token and call the report endpoint:

  1. Open a terminal and run this command:

    TOKEN=$(curl -s https://anypoint.mulesoft.com/accounts/login -d "username=<YOUR-USERNAME>&password=<YOUR-PASSWORD>" | jq -r .access_token)

    This command returns an access token stored in the $TOKEN variable:

    {
     "access_token": "54545454-5454-5454-5454-545454545454",
     "token_type": "Bearer",
     "redirectUrl": "/accounts/#/cs/profile/home"
     }

    The jq command-line JSON processor is one option for getting the access token value. Download and install it or equivalent software.

  2. Copy the URL from the Manage Reports page and use the $TOKEN variable in the next request.

    Example for organizations without environments:

    curl -H "Authorization: Bearer $TOKEN" "https://anypoint.mulesoft.com/analytics/1.0/<ORGANIZATION_ID>/events?format=csv&startDate=2016-01-01&endDate=2016-12-31&fields=Application%20Name.Client%20IP.Resource%20Path" > output.csv

    Example for organizations with environments:

    curl -H "Authorization: Bearer $TOKEN" "https://anypoint.mulesoft.com:443/analytics/1.0/<ORGANIZATION_ID>/environments/<ENVIRONMENT_ID>/events?format=csv&apiIds=<API_ID>&duration=30d" > output.csv
  3. If the request is successful, an output file downloads to the directory where you ran the command.

Curl Command Options Reference

You can add optional query parameters to curl commands:

Option Description

apiIds

Comma-delimited list of API IDs to include in a query. Omit or specify all or * to include all APIs.

Type: string
Required: no
Example: appIds=42,54

apiVersionIds

Comma-delimited list of API version IDs to include in query. Omit or specify all or * to include all API versions. Ignored if no value was specified for API IDs.

Type: string
Required: no
Example: apiVersionIds=42,54

duration

The duration over which the report should return data. Consists of an integer number denoting quantity and a single-letter suffix denoting units.

Suffix is one of:

  • d: Days

  • h: Hours

  • m: Minutes

  • s: Seconds

To cover a duration of one week, specify 7d as the duration. To cover half a minute, specify 30s.

Type: string
Required: no
Example: duration=45m

fields

Fields to include in the report. Required for CSV output and optional for JSON output. The list of fields can be comma- or period-delimited. Use %20 for spaces. You can use any value in Report Data Fields Reference. Timestamp, API Name, API ID, API Version, API Version ID are always included in reports.

Type: string
Required: no
Example: fields=Hardware%20Platform.Client%20IP.Resource%20Path

format

Determines the serialization format of the returned data. Either csv or json.

Type: string
Required: yes
Example: format=csv

maxResults

Maximum number of events to return. Default value is 20000.

Type: integer
Required: no
Example: maxResults=3

startDate

Starting date and time, as described by ISO Date Time Parser.

Type: date
Required: no
Example: startDate=2016-01-01T08:15:30-05:00

endDate

Ending date and time, as described by ISO Date Time Parser.

Type: date
Required: no
Example: endDate=2016-11-10

Report Data Fields Reference

Your report can include these fields:

Data Field Name Description

Application

Client ID associated with the incoming API request.

Application Name

Name of the application making the API request (only available when a client ID is passed with the request).

Browser

Browser type associated with the incoming API request.

City

The city from which the API request originated (inferred by the IP address of the client).

Client IP

IP address of the client making the API request.

Continent

The continent from which the API request originated (inferred by the IP address of the client).

Country

The country from which the API request originated (inferred by the IP address of the client).

Hardware Platform

The hardware type of the client making the request (such as Mobile, Tablet, Desktop, etc.).

Message ID

Message ID value.

OS Family

The client OS type: Mac OS X, iOS, Windows, Linux.

OS Major Version

Operating system major version.

OS Minor Version

Operating system minor version.

OS Version

Operating system version.

Postal Code

The postal code from which the API request originated (inferred by the IP address of the client).

Request Outcome

Indicates whether a request was successful or resulted in a policy violation.

Request Size

The size (in bytes) of the incoming client request.

Resource Path

The path of the client request.

Response Size

The size in bytes of the API response. See note below.

Response Time

The processing time of the API request.

Runtime Host

The hostname of the Mule runtime that processed the API request.

Status Code

The HTTP status code of the response.

Timezone

The time zone from which the API request originated (inferred by the IP address of the client).

User Agent Name

The complete user agent string for the incoming client request.

User Agent Version

The version of the user agent string for the incoming client request.

Verb

The REST verb associated with the API client request (GET, POST, PATCH, etc.).

Violated Policy Name

The name of the policy violated by the API request (if any).

In your query, if the Content-Length header is:

  • Present: Response Size is set to that value.

  • Not present and the payload is a String: Mule API Analytics calculates the length of the String and reports that value.

  • Not present and the payload is not a String: Mule API Analytics reports the response size as -1.

    For example, if the output returned is a DataWeave stream and the Content-Length header is not present, the Analytics Event API does not report a response size because the value is not a String. However if your application performs a String conversion, the response size is listed.

Restrict Client IP Data in Analytics

If you don’t want to forward client IP data, set anypoint.platform.analytics_include_client_ip=false in the wrapper.conf file of your Mule runtime. To set properties, refer to Configuring Properties.

If you choose not to forward client IP data, geolocalized data such as City, Continent, Postal Code, Country, and Timezone is also not available.