Skip to content

feat: Fetch logs through the CLI#42

Open
andyland wants to merge 1 commit into
mainfrom
andy/cli-logs
Open

feat: Fetch logs through the CLI#42
andyland wants to merge 1 commit into
mainfrom
andy/cli-logs

Conversation

@andyland

Copy link
Copy Markdown
Contributor

Users will be able to grab logs for all their things with the CLI.

Supports jobs, sandboxes, mmt, deployments, querying, pagination, limits, timestamp filtering and severity

Loom: https://www.loom.com/share/ae2bdae35a29438bb4a09021d4d383f7

Job

lightning logs --job_name my_job
lightning logs --job_id job_1234

Deployment

lightning logs --deployment_name my_deployment
lightning logs --deployment_id dep_12345

MMT

lightning logs --mmt_name my_mmt
lightning logs --mmt_id mmt_1234

Sandbox

lightning logs --sandbox_name my_sandbox
lightning logs --sandbox_id sb_1234
Usage: lightning logs [OPTIONS]                                                                                                                            
                                                                                                                                                            
 Search and page through logs across a teamspace.                                                                                                           
 Filter by resource (--job-id/--job-name, --deployment-id/--deployment-name, --mmt-id/--mmt-name, --sandbox-id/--sandbox-name, --sandbox-command-id), text  
 (--query), severity and time range. Results are paginated: re-run with --page-token set to the token printed at the end of the previous page to continue.  
 Examples:   lightning logs --job-name my-job --query error --limit 100   lightning logs --deployment-name my-api --severity warning   lightning logs       
 --sandbox-id sbx-42 --sandbox-command-id cmd-abc   lightning logs --job-id job-123 --page-token <token>                                                    
                                                                                                                                                            
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --teamspace                                    TEXT                        the teamspace to search logs in, as {owner}/{name} (e.g.                      │
│                                                                            my-org/my-teamspace). If not provided, can be selected interactively.         │
│ --job-id,--job_id                              TEXT                        restrict to a job (by id).                                                    │
│ --job-name,--job_name                          TEXT                        restrict to a job (by name).                                                  │
│ --deployment-id,--deployment_id                TEXT                        restrict to a deployment (by id).                                             │
│ --deployment-name,--deployment_name            TEXT                        restrict to a deployment (by name).                                           │
│ --mmt-id,--mmt_id                              TEXT                        restrict to a multi-machine job (by id).                                      │
│ --mmt-name,--mmt_name                          TEXT                        restrict to a multi-machine job (by name).                                    │
│ --sandbox-id,--sandbox_id                      TEXT                        restrict to a sandbox (by id).                                                │
│ --sandbox-name,--sandbox_name                  TEXT                        restrict to a sandbox (by name).                                              │
│ --sandbox-command-id,--sandbox_command_id      TEXT                        restrict to a single sandbox command (by id).                                 │
│ --query                                    -q  TEXT                        only return lines matching this text.                                         │
│ --severity                                     [error|warning|info|debug]  minimum severity to include (error > warning > info > debug).                 │
│ --since                                        TEXT                        only lines at or after this time (e.g. "1h", RFC3339).                        │
│ --until                                        TEXT                        only lines at or before this time.                                            │
│ --limit                                    -n  INTEGER                     maximum number of lines to return.                                            │
│ --page-token,--page_token                      TEXT                        cursor from a previous run's next page token, to fetch the following page.    │
│ --timestamps/--no-timestamps                                               prefix each line with its timestamp.                                          │
│ --json                                                                     emit entries and the next page token as JSON.                                 │
│ --help                                                                     Show this message and exit.                                                   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                                                                                                                                                            
 DOCS  https://lightning.ai/docs/cli             

@andyland andyland changed the title feat: CLI logs feat: Fetch logs through the CLI Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant