Overview of Logging and Metrics

Page last updated:

This topic provides an overview of logging and metrics in Cloud Foundry (CF). It includes information about logs and metrics sources and transport systems. It also lists products for viewing logs and metrics.

Accessing Metrics

You must use a Cloud Foundry Command-Line Interface (cf CLI) plugin to access and view metrics directly from the command line. You can use either the Firehose plugin or the Log Cache plugin.

Access Metrics Using the Log Cache CLI Plugin

To access metrics using the Log Cache plugin:

  1. Log in to the cf CLI by running:

    cf login -a API-URL -u USERNAME -p PASSWORD
    

    Where:

    • API-URL is your API endpoint.
    • USERNAME is your username.
    • PASSWORD is your password.
  2. Install the Log Cache CLI plugin by running:

    cf install-plugin -r CF-Community "log-cache"
    

    For more information, see log-cache in cf CLI Plugins on the Cloud Foundry website.

  3. Run:

    cf query 'METRIC-NAME{source_id="SOURCE-ID"}'

    

    Where:

    • METRIC-NAME is the name of the metric you want to view.
    • SOURCE-ID is the source ID of the component for which you want to view metrics.

      To find the source ID and metric name of the metric you want to view, see CF Component Metrics and UAA Performance Metrics.

Access Metrics Using the Firehose Plugin

To access metrics using the Firehose plugin:

  1. Log in to the cf CLI by running:

    cf login -a API-URL -u USERNAME -p PASSWORD
    

    Where:

    • API-URL is your API endpoint.
    • USERNAME is your username.
    • PASSWORD is your password.
  2. Install the Firehose cf CLI plugin by running:

    cf install-plugin -r CF-Community "Firehose Plugin"
    

    For more information, see Firehose Plugins in cf CLI Plugins on the Cloud Foundry website.

  3. Run:

    cf nozzle -no-filter | grep SOURCE-ID | grep -i METRIC-NAME
    

    Where:

    • METRIC-NAME is the name of the metric you want to view.
    • SOURCE-ID is the source ID of the component for which you want to view metrics.

      For example:
    cf nozzle -no-filter | grep bbs | grep -i ConvergenceLRPDuration
    

    Because metrics are scraped at different intervals, it may take up to fifteen minutes for the Firehose to receive all metrics for the component. Re-run cf nozzle until you have received a complete set of metrics for a component. For more information, see Firehose Architecture in Loggregator Architecture.

    To find the source ID and metric name of the metric you want to view, see CF Component Metrics and UAA Performance Metrics.

For more information about nozzles, see Scaling Nozzles in Loggregator Guide for CF Operators..

Sources of Logs and Metrics

There are two sources of CF logs and metrics:

  • CF platform components, such as a Diego Cell, MySQL Server, or Cloud Controller
  • Apps and app containers deployed on CF

The table below describes the data included in logs and metrics from each source:

Source Logs Data Metrics Data
Platform components Logs from CF components
  • Health metrics from BOSH-deployed VMs1
  • Platform metrics from CF components. For example, Diego Cell capacity remaining and Gorouter throughput.
  • Metrics for any service tile that self-publishes to the Loggregator Firehose. For example, Redis and MySQL.
Apps and app containers Logs from apps2
  • Container metrics3

1For more information about using the BOSH Health Monitor to collect health metrics on VMs, see Configuring Health Monitor Notifications.

2For more information about app logging, see App Logging in Cloud Foundry.

3For more information about container metrics, see Container Metrics.

Transport Systems for Logs and Metrics

The following transport systems deliver logs and metrics from their source to an observability product for viewing:

  • Loggregator: Loggregator is the transport system for both logs and metrics on apps deployed on CF, as well as metrics on CF platform components. For more information about the Loggregator system, including Loggregator architecture and components, see Loggregator Architecture.

  • rsyslogd on CF component VMs: rsyslogd is the transport system for CF component logs. Users can configure rsyslogd to transport component logs to a third-party syslog server.

The table below lists the transport system for logs and metrics on CF platform components and apps:

Source Logs Transport System Metrics Transport System
Platform components rsyslogd on CF component VMs Loggregator
Apps Loggregator Loggregator

Viewing Logs and Metrics

The table below lists the products and tools for viewing CF logs and metrics:

Source Products and Tools for Viewing Logs Products and Tools for Viewing Metrics
Platform components To view system logs from CF components, configure rsyslogd to transport logs to a third-party product. You can use the following products or tools to view platform component and VM metrics:
Apps You can use the following products or tools to view app logs: You can use the following products or tools to view app metrics:
Create a pull request or raise an issue on the source for this page in GitHub