# Leaderboard Logging

gm-control can be configured to log a leaderboard of non-2xx requests on a time interval to `stdout`. This is useful as a quick way to see which endpoints are performing poorly throughout the mesh, without getting into advanced debugging.

## Configuration

Leader board logging is configured with two following parameters:

| **Environment Variable**               | **CLI Flag**                  | **Meaning**                                        | **Type** | **Example** |
| -------------------------------------- | ----------------------------- | -------------------------------------------------- | -------- | ----------- |
| `GM_CONTROL_XDS_GRPC_LOG_TOP_INTERVAL` | `--xds.grpc-log-top-interval` | How often leaderboards are logged and counts reset | Duration | `5m3s`      |
| `GM_CONTROL_XDS_GRPC_LOG_TOP`          | `--xds.grpc-log-top`          | How many unique requests are logged                | integer  | `5`         |

Leaderboarding can be disabled by setting `GM_CONTROL_XDS_GRPC_LOG_TOP` to `0`.

## Schema

Leaderboards are logged to standard out in the format:

```
[info] <timestamp> ALS: <number of requests>: <HTTP response code> <request path>
```

Example:

```bash
[info] 2020/02/25 20:52:16 ALS: 1: 475 http://localhost:8080/error
```
