# Logs Semantics This document explains exactly how DAM's `logs` command works, including its human-readable keyword parsing, restrictions, and piping behavior. --- ## Overview The `logs` command allows you to view the standard output (`stdout`) and standard error (`stderr`) streams for your app containers. Rather than forcing you to memorize Docker's specific flags (`-f`, `--tail`, `-t`), DAM provides a human-friendly, chainable keyword syntax. > This logs command is still in development phase and is not fully integrated with traditional docker compose logs, so please expect bugs or unexpected behavior and be patient. > DAM operates at the project/app level by default. If you have an app like `` that has multiple services inside its `compose.yaml` (e.g., ``, `postgres`, `redis`), DAM's `logs` command will fetch and interleave the logs for all three services at once unless you specify a service. > DAM supports targeting specific services using the `app:service` syntax. You can view logs for a specific service by running `dkr logs :postgres`. If you accidentally specify a service name separated by a space, like: `dkr logs postgres` DAM will think `postgres` is a second app folder, fail to find it, and throw an error. Always use the colon syntax (`:`) to target services. --- ## Explicit Compose Files Append `using ...` to select Compose files explicitly. If none of the requested files resolve for an app, `logs` logs an informational message and falls back to that app's default Compose file. If one or more resolve, DAM uses only the resolved files and warns about any misses. --- ## Examples Scenarios ```bash # View all logs for a single app dkr logs # View logs for a specific service in an app dkr logs :postgres # View the last 100 lines dkr logs last 100 # View the first 50 lines (piped through head) dkr logs first 50 # Chain multiple keywords: last 10 lines, live stream, with timestamps dkr logs last 10 live time # View logs from the last 30 minutes dkr logs since 30m # View static logs for all apps (no 'live' allowed) dkr logs all last 20 ``` --- ## Argument Parsing and Flow When the `logs` command is executed, DAM parses your requested app(s) alongside any number of chaining keywords. ### Step 1: Keyword Translation DAM parses the arguments sequentially, looking for specific keywords to translate into `docker compose logs` flags: | Keyword | Alias | Translated Flag | Effect | | :--- | :--- | :--- | :--- | | `live` | `follow` | `-f` | Streams logs in real-time, keeping the connection open. | | `time` | `timestamps` | `-t` | Prefixes every log line with a precise timestamp. | | `last ` | | `--tail` or `--since` | Shows last `N` lines (e.g., `last 100`) or dynamically switches to time (e.g., `last 30m`). | | `since