Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Display logs of a specific container.

```
USAGE
$ mw container logs CONTAINER-ID -o txt|json|yaml [--token <value>] [-p <value>] [--no-pager]
$ mw container logs CONTAINER-ID -o txt|json|yaml [--token <value>] [-p <value>] [--no-pager] [-t <value>]

ARGUMENTS
CONTAINER-ID ID of the container for which to get logs
Expand All @@ -261,6 +261,7 @@ FLAGS
<options: txt|json|yaml>
-p, --project-id=<value> ID or short ID of a project; this flag is optional if a default project is set in the
context
-t, --tail=<value> Number of lines to show from the end of the logs (minimum: 1).
--no-pager Disable pager for output.

AUTHENTICATION FLAGS
Expand Down
9 changes: 9 additions & 0 deletions src/commands/container/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export class Logs extends BaseCommand {
"no-pager": Flags.boolean({
description: "Disable pager for output.",
}),
tail: Flags.integer({
char: "t",
description:
"Number of lines to show from the end of the logs (minimum: 1).",
min: 1,
}),
};
static args = {
"container-id": Args.string({
Expand All @@ -44,6 +50,9 @@ export class Logs extends BaseCommand {
const logsResp = await this.apiClient.container.getServiceLogs({
stackId,
serviceId,
queryParameters: {
...(flags.tail && { tail: flags.tail }),
},
});
assertStatus(logsResp, 200);

Expand Down