> For the complete documentation index, see [llms.txt](https://docs.opensoutheners.com/oss/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opensoutheners.com/oss/lambdary/guides/logs-metrics-and-health.md).

# Logs, Metrics and Health

Read function output, invocation metrics and server health from a running dev server.

## Logs

`lambdary dev` prints every function's output to its own terminal, with a color-coded `[name]` prefix and a Lambda-style `REPORT` line per invocation.

`lambdary logs` prints the output of a running dev server's functions from another terminal, as `[function] line`:

```sh
lambdary logs worker -f --tail 20     # follow one function; omit it for all
```

The server keeps the last 1,000 lines per function. `--tail` (default 100) picks how many to show, and `-f` keeps printing new ones until you interrupt it.

A bare function name includes the output of every published version of the function. `worker:2` selects one version, and `worker:live` the versions the alias routes to now.

`--port` picks the dev server to ask, by default `lambdary.yml`'s `port` or `8000`. Set `NO_COLOR` to turn colors off.

### `GET /_lambdary/logs`

Behind `lambdary logs`, `GET /_lambdary/logs?function=<name>&tail=<n>&follow=1` streams the same lines as NDJSON:

```sh
curl 'http://127.0.0.1:8000/_lambdary/logs?function=worker&tail=20'
```

```json
{"function":"worker","time":"2026-11-17T09:00:00.123Z","text":"processing 3 messages"}
```

| Parameter  | Default       | Description                                                        |
| ---------- | ------------- | ------------------------------------------------------------------ |
| `function` | all functions | A name, `name:version` or `name:alias`. Unknown ones answer `404`. |
| `tail`     | `100`         | How many buffered lines to replay, a non-negative integer.         |
| `follow`   | `0`           | `1` keeps streaming new lines until the client disconnects.        |

## Metrics

`GET /_lambdary/metrics?window=1h` returns a JSON summary of each function's invocations, errors, throttles and duration percentiles over the window (a Go duration such as `15m` or `1h`, one hour by default), in total and per version or alias:

```sh
curl 'http://127.0.0.1:8000/_lambdary/metrics?window=15m'
```

```json
{
  "window": "15m0s",
  "functions": [
    {
      "name": "notify",
      "total": {"resource": "", "invocations": 12, "errors": 1, "throttles": 0, "duration_ms": {"p50": 41.2, "p95": 120.5, "max": 133.0}},
      "resources": [
        {"resource": "notify:$LATEST", "invocations": 10, "errors": 1, "throttles": 0, "duration_ms": {"p50": 40.1, "p95": 118.9, "max": 133.0}},
        {"resource": "notify:2", "invocations": 2, "errors": 0, "throttles": 0, "duration_ms": {"p50": 45.0, "p95": 47.3, "max": 47.3}},
        {"resource": "notify:live", "invocations": 2, "errors": 0, "throttles": 0, "duration_ms": {"p50": 45.0, "p95": 47.3, "max": 47.3}}
      ]
    }
  ]
}
```

Resource values follow CloudWatch's `Resource` dimension: `<fn>:<version>`, `<fn>:$LATEST`, and `<fn>:<alias>` for invokes that went through an alias. An alias invoke counts under both its version and its alias.

### CloudWatch `GetMetricData`

The CloudWatch `GetMetricData` call works too, for the `AWS/Lambda` namespace with a `FunctionName` dimension and an optional `Resource` dimension (`<fn>:<version>`, `<fn>:<alias>` or `<fn>:$LATEST`). Current AWS SDKs send it over Smithy RPCv2 with CBOR bodies, and so does the server.

|            | Supported                                                                            |
| ---------- | ------------------------------------------------------------------------------------ |
| Metrics    | `Invocations`, `Errors`, `Throttles`, `Duration`                                     |
| Statistics | `Sum`, `SampleCount`, `Average`, `Minimum`, `Maximum`, and percentiles such as `p99` |

```sh
export AWS_ENDPOINT_URL_CLOUDWATCH=http://127.0.0.1:8000
```

Metrics are kept in memory and start over when the server restarts. An invocation whose function fails to start is not counted, as on AWS.

{% hint style="warning" %}
The `Throttles` metric reads 0 in practice. Requests to one function wait for each other instead of being throttled. See [Limitations](https://docs.opensoutheners.com/oss/lambdary/reference/limitations.md#metrics).
{% endhint %}

## Health

`GET /_lambdary/health` answers `200` with each function's state, `running` or `stopped` (it starts on its next invoke), for a Compose healthcheck:

```json
{"status":"ok","functions":[{"name":"api","state":"running"},{"name":"worker","state":"stopped"}]}
```

The [Docker image](https://docs.opensoutheners.com/oss/lambdary/guides/docker-compose.md) has busybox's `wget`:

```yaml
    healthcheck:
      test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8000/_lambdary/health"]
      interval: 5s
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.opensoutheners.com/oss/lambdary/guides/logs-metrics-and-health.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
