vk logs
vk logs [options]Options
Section titled “Options”| Option | Description | Default |
|---|---|---|
-s, --stage <stage> | Deployment stage | dev |
-f, --follow | Follow log output (poll every 2s) | false |
--since <duration> | Show logs since duration (5m, 1h, 2d) | 5m |
--filter <pattern> | CloudWatch filter pattern | — |
-n, --limit <count> | Maximum number of events | 100 |
Description
Section titled “Description”Streams events from the CloudWatch Log Groups created by your deployed Lambda functions. The CLI:
- Reads the project name from
vk.config.ts(falls back topackage.json#name). - Lists log groups under
/aws/lambda/<project>-<stage>*. - Fetches matching events via
FilterLogEvents. - Color-codes lines by log level (
ERRORred,WARNyellow, LambdaSTART/END/REPORTdim). - With
--follow, polls every 2 seconds for new events until you pressCtrl+C.
Examples
Section titled “Examples”# Show the last 5 minutes of logs from devvk logs
# Stream new logs as they arrivevk logs -f
# Show the last hour from prodvk logs --stage prod --since 1h
# Filter to just errorsvk logs --filter ERROR
# Increase the per-group event capvk logs -n 500Duration Format
Section titled “Duration Format”The --since flag accepts a number followed by s, m, h, or d:
| Suffix | Unit | Example |
|---|---|---|
s | seconds | 30s |
m | minutes | 15m |
h | hours | 2h |
d | days | 7d |
Requirements
Section titled “Requirements”- An AWS account with credentials set in the environment (
AWS_PROFILE,AWS_REGION, etc.) or~/.aws/credentials. - A previously successful
vk deploy --stage <stage>so the log groups exist. - The
@aws-sdk/client-cloudwatch-logspackage is loaded lazily and is bundled with the CLI.
Output
Section titled “Output”Each line is prefixed with the event timestamp in YYYY-MM-DD HH:MM:SS.mmm format, then the raw log message. When the CLI inspects multiple log groups it prints a ── <function-name> ── header before each group’s events.