diff --git a/content/doc/ai-llms.md b/content/doc/ai-llms.md index e81d5475d..22bba2f1a 100644 --- a/content/doc/ai-llms.md +++ b/content/doc/ai-llms.md @@ -111,7 +111,7 @@ A throwaway environment and a production one differ by their plan, not by their An agent reads all of it through the same CLI it used to deploy: ```bash -clever logs --since 10m +clever logs --since 10m --until now clever activity clever status ``` diff --git a/content/doc/develop/observability/access-logs.md b/content/doc/develop/observability/access-logs.md index b7ad03947..61ba35116 100644 --- a/content/doc/develop/observability/access-logs.md +++ b/content/doc/develop/observability/access-logs.md @@ -25,8 +25,11 @@ You can see access logs with the following command: clever accesslogs ``` -As with the `logs` command, you can specify `--before` and `--after` flags. -If you don't specify any options, the logs display continuously. +As with the `logs` command, you can specify `--since` and `--until`. Without `--until`, the command keeps following new requests, even with `--since`. Set `--until` to stop at a given end time and get the prompt back, and add `--since` to choose where to start. Use `--until now` to read up to the current time: + +```bash +clever accesslogs --since 15m --until now +``` To change the output, specify the `--format` (`-F`) flag with one of these values: @@ -44,7 +47,7 @@ To change the output, specify the `--format` (`-F`) flag with one of these value The HTTP protocol version isn't part of the access log payload, so the request line is limited to `method path` (no `HTTP/x.y` token). -- `json`: a JSON array of log objects (requires a bounding flag such as `--before`) +- `json`: a JSON array of log objects (requires a bounding flag such as `--until`) - `json-stream`: a stream of JSON log objects Both JSON formats share the same object shape: diff --git a/content/doc/develop/observability/logs.md b/content/doc/develop/observability/logs.md index e58dc4cec..fcf93f13c 100644 --- a/content/doc/develop/observability/logs.md +++ b/content/doc/develop/observability/logs.md @@ -49,6 +49,13 @@ clever logs --since 2h clever logs --until 2024-04-15T13:37:42Z ``` +Without `--until`, `clever logs` keeps following new lines after printing the past ones, even with `--since`. Set `--until` to stop at a given end time and get the prompt back, as a script or an AI agent needs, and add `--since` to choose where to start. Use `--until now` to read up to the current time. The `json` output format requires `--until`: + +```bash +clever logs --since 15m --until now +clever logs --since 15m --until now --format json +``` + You can also get your add-on's logs by using `--addon` flag, the value is the add-on ID starting by `addon_`, or its real ID: ```bash diff --git a/content/doc/manage/cli/applications/deployment-lifecycle.md b/content/doc/manage/cli/applications/deployment-lifecycle.md index 6782946bb..d2904642c 100644 --- a/content/doc/manage/cli/applications/deployment-lifecycle.md +++ b/content/doc/manage/cli/applications/deployment-lifecycle.md @@ -121,11 +121,11 @@ clever instances clever ssh --instance INSTANCE_ID ``` -`clever instances` lists the running instances of your application by default. Add `--all` to list instances in any state, including deleted ones. Filter them by period with `--after` and `--before`, which select the instances that existed during that period, or by deployment with `--deployment-id`: these filters also include past instances. The command lists the 100 most recent matching instances by default, use `--limit` to get up to 1,000: +`clever instances` lists the running instances of your application by default. Add `--all` to list instances in any state, including deleted ones. Filter them by period with `--since` and `--until`, which select the instances that existed during that period, or by deployment with `--deployment-id`: these filters also include past instances. The command lists the 100 most recent matching instances by default, use `--limit` to get up to 1,000: ```console clever instances --all -clever instances --after 1d --format json +clever instances --since 1d --format json ``` To execute a single command on the remote instance and exit, use `--command` (`-c`). Clever Tools runs it in `bash` when the instance provides it, in `/bin/sh` otherwise. Its output streams to your terminal without the SSH gateway messages, so you can use it in scripts: @@ -159,6 +159,12 @@ You can also get logs from a specific timeline, deployment or add-on through opt [--format, -F] FORMAT Output format (human, json, json-stream) (default: human) ``` +By default, logs keep streaming. Use `--until` to set an end time. To read the last 15 minutes and exit, use: + +```console +clever logs --since 15m --until now +``` + ## access logs When you deploy an application on Clever Cloud, we collect its access logs, hosted in our internal Pulsar stack, all included. To listen to the stream, use: @@ -167,9 +173,6 @@ When you deploy an application on Clever Cloud, we collect its access logs, host clever accesslogs ``` -> [!TIP] -> This now uses our v4 API, it's available as Alpha feature for now. - You can also get access logs from a specific timeline through options, in multiple formats: ```text @@ -180,7 +183,7 @@ You can also get access logs from a specific timeline through options, in multip Besides HTTP requests, access logs include TCP redirections and SSH connections to your instances. In the `human` format, a column shows the transport of each line, `HTTP`, `TCP` or `SSH`, and HTTP methods and paths get their own columns so they stay aligned. The `clf` format, for Common Log Format, only outputs HTTP access logs. -You can for example get access logs in JSON stream format for the last hour with: +You can for example follow access logs in JSON stream format, starting from the last hour, with: ```console clever accesslogs --format json-stream --since 1h