> ## Documentation Index
> Fetch the complete documentation index at: https://www.aptible.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Logs

> Learn about how to access and retain logs from your Aptible resources

# Overview

With each operation, the output of your [Containers](https://www.aptible.com/docs/core-concepts/architecture/containers/overview.md) is collected as Logs. This includes changes to your resources such as scaling, deploying, updating environment variables, creating backups, etc.

> [!NOTE]
>
> Strictly speaking, `stdout` and `stderr` are captured. If you are using Docker locally, this is what you'd see when you run `docker logs ...`. Most importantly, this means **logs sent to files are not captured by Aptible logging**, so when you deploy your [Apps](https://www.aptible.com/docs/core-concepts/apps/overview.md) on Aptible, you should ensure you are logging to `stdout` or `stderr`, and not to log files.

# Quick Access Logs

Aptible streams live Logs for quick access. For long term retention of logs, you will need to set up a [Log Drain](https://www.aptible.com/docs/core-concepts/observability/logs/log-drains/overview.md).

> [tab] Using the CLI
>
> App and Database logs can be accessed in real-time from the [CLI](https://www.aptible.com/docs/reference/aptible-cli/overview.md) using the [`aptible logs`](https://www.aptible.com/docs/reference/aptible-cli/cli-commands/cli-logs) command. Upon executing this command, only the logs generated from that moment onward will be displayed.
>
> Example:
>
> ```
> aptible logs --app "$APP_HANDLE"
> aptible logs --database "$DATABASE_HANDLE"
> ```

> [tab] Using the the Aptible Dashboard
>
> ![](https://mintcdn.com/aptible/gJr2xlqbHzeeHUse/images/Logs-overview.png?fit=max\&auto=format\&n=gJr2xlqbHzeeHUse\&q=85\&s=6200085336a53f33c403c5fa52e8ec3c)
>
> Within the Aptible Dashboard, logs for recent operations can be acccessed by viewing recent [Activity](https://www.aptible.com/docs/core-concepts/observability/activity/overview.md).

# Log Integrations

## Log Drains

Log Drains let you route Logs to logging destinations for reviewing, searching, and alerting. Log Drains support capturing logs for Apps, Databases, SSH sessions, and Endpoints.

> [card] [Learn more about Log Drains](https://www.aptible.com/docs/log-drains.md)

## Log Archiving

Log Archiving lets you route Logs to S3 for business continuity and compliance. Log Archiving supports capturing logs for Apps, Databases, SSH sessions, and Endpoints.

> [card] [Learn more about Log Archiving](https://www.aptible.com/docs/s3-log-archives.md)
