Skip to content

vk logs

Terminal window
vk logs [options]
OptionDescriptionDefault
-s, --stage <stage>Deployment stagedev
-f, --followFollow 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 events100

Streams events from the CloudWatch Log Groups created by your deployed Lambda functions. The CLI:

  1. Reads the project name from vk.config.ts (falls back to package.json#name).
  2. Lists log groups under /aws/lambda/<project>-<stage>*.
  3. Fetches matching events via FilterLogEvents.
  4. Color-codes lines by log level (ERROR red, WARN yellow, Lambda START/END/REPORT dim).
  5. With --follow, polls every 2 seconds for new events until you press Ctrl+C.
Terminal window
# Show the last 5 minutes of logs from dev
vk logs
# Stream new logs as they arrive
vk logs -f
# Show the last hour from prod
vk logs --stage prod --since 1h
# Filter to just errors
vk logs --filter ERROR
# Increase the per-group event cap
vk logs -n 500

The --since flag accepts a number followed by s, m, h, or d:

SuffixUnitExample
sseconds30s
mminutes15m
hhours2h
ddays7d
  • 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-logs package is loaded lazily and is bundled with the CLI.

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.