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

# logs

> cpln logs — Query and display logs from workloads and other Control Plane resources.

Show logs

For a detailed overview, please visit the [logs'](/reference/logs) reference page.

**Usage**

```none theme={null}
cpln logs <query> [OPTIONS]
```

<Tip>
  The `<query>` positional requires a valid [LogQL](https://grafana.com/docs/loki/latest/logql/) string enclosed within single quotes.

  Available query labels: `gvc`, `workload`, `container`, `location`, `provider`, `replica`, `stream`
</Tip>

<Accordion title="Reference">
  ```text theme={null}
  Command options:
    --tail, -t, -f  Tail the logs (follow)  [boolean]
    --limit         Maximum number of log entries to return. Use 0 for unlimited (auto-paginates through the full time range)  [number] [default: 30]
    --delay-for     Delay in tailing by number of seconds to accumulate logs for re-ordering  [number] [default: 0]
    --since         Lookback window  [default: "1h"]
    --from          Start looking for logs at this absolute time (inclusive)
    --to            Stop looking for logs at this absolute time (exclusive)
    --output, -o    Specify output mode. raw suppresses log labels and timestamp  [choices: "default", "raw", "jsonl"] [default: "default"]
    --direction     Sort order of logs  [choices: "forward", "backward"] [default: "forward"]

  Positionals:
    query  LogQL query  [required]

  Context options:
    --profile  Override the profile. The default profile can be set using the `cpln profile set-default` command or by setting the CPLN_PROFILE environment variable
    --org      Override the organization. The default organization can be set in your profile by using the `cpln profile update` command

  Request options:
    --token         Override the authorization token
    --endpoint      Override the API URL
    --insecure, -k  Ignore TLS errors  [boolean]

  Debug options:
    --verbose, -v  Enable verbose output to stderr  [boolean] [default: false]
    --debug, -d    Show all HTTP communications  [boolean] [default: false]

  Options:
    --help     Show help  [boolean]
    --version  Show version number  [boolean]
  ```

  [Common Options Reference](/cli-reference/using-cli/common-options)
</Accordion>

<Accordion title="Example">
  <CodeGroup>
    ```bash Command theme={null}
    cpln logs '{gvc="demo-gvc-logs",workload="demo-workload-logs"}'
    ```

    ```text Output theme={null}
    2021-02-23T18:45:03.411Z {workload="demo-workload-logs", container="main", gvc="demo-gvc-logs", location="aws-eu-central-1", provider="aws", replica="712438d4-aee8-44aa-b7a9-c9ed62b6ea69", stream="stderr"} 2021/02/23 18:45:03 Hello world sample started.
    2021-02-23T18:45:06.177Z {workload="demo-workload-logs", container="main", gvc="demo-gvc-logs", location="aws-eu-central-1", provider="aws", replica="712438d4-aee8-44aa-b7a9-c9ed62b6ea69", stream="stderr"} 2021/02/23 18:45:06 Hello world received a request.
    ```
  </CodeGroup>

  <CodeGroup>
    ```bash Command theme={null}
    cpln logs '{provider="aws"}'
    ```

    ```text Output theme={null}
    2021-02-23T18:45:03.411Z {container="main", gvc="demo-gvc-logs", location="aws-eu-central-1", provider="aws", replica="712438d4-aee8-44aa-b7a9-c9ed62b6ea69", stream="stderr", workload="demo-workload-logs"} 2021/02/23 18:45:03 Hello world sample started.
    2021-02-23T18:45:06.177Z {container="main", gvc="demo-gvc-logs", location="aws-eu-central-1", provider="aws", replica="712438d4-aee8-44aa-b7a9-c9ed62b6ea69", stream="stderr", workload="demo-workload-logs"} 2021/02/23 18:45:06 Hello world received a request.
    ```
  </CodeGroup>
</Accordion>

***
