rk logs
Summary
Collect and query device logs (server mode only, except tail --source firmware).
Description
Log sessions keep a persistent telnet connection to the device and store a circular buffer in memory for fast retrieval, search and tailing. Every subcommand except ports and tail --source firmware needs a running rk server; start one with npx rk server. For RCE targets in server mode, the server reads the RCE token from its own environment or the token saved with rk device set-rce-token. Every subcommand that takes options accepts the whole option table below, but each option only takes effect for the subcommands its description names.
Usage
rk logs <subcommand> [options]Options
| Flag | Value/type | Allowed values | Default | Required |
|---|---|---|---|---|
--device | id|ip|name (string) | — | the active device | no |
--host | ip|hostname (string) | — | — | no |
--password | password (string) | — | — | no |
--port | number (number) | — | 8085 | no |
--buffer-size | lines (number) | — | 10000 | no |
--lines | number (number) | — | 50 for get, 100 for search | no |
--output | file (string) | — | — | no |
--format | txt|json (string) | txt, json | txt | no |
--case-sensitive | boolean | — | — | no |
--all | boolean | — | — | no |
--prefix | boolean | — | — | no |
--append | boolean | — | — | no |
--verbose | boolean | — | — | no |
--device
Target device, or rce:<name>.
Example:
rk logs start --device rce:living-room--host
Connect directly to device (bypasses device store).
--password
Device developer password override.
--port
Telnet port (allowed range 1-65535).
--buffer-size
Circular buffer size (start only; range 100-100000).
--lines
Number of lines to retrieve (get) or maximum matches returned (search); range 1-100000.
--output
Write output directly to file (get only).
--format
Output format for export (get only). json writes an array of [timestamp, device, line].
--case-sensitive
Enable case-sensitive search (search only).
--all
Stop all sessions (stop only). With --device, stops every port for that device; on its own, stops every session for every device.
--prefix
Prefix log lines with timestamp and device name (tail only).
--append
Append to output file instead of overwriting (get only).
--verbose
Show detailed metrics: connected, last activity, reconnections and uptime (list only).
Environment variables
| Environment variable | Description |
|---|---|
RK_RCE_TOKEN | The Roku Cloud Emulator (RCE) token. When set, it takes precedence over the token saved by rk device set-rce-token. That suits CI, where the token comes from a masked variable. |
RK_RCE_API_URL | Points rk at another RCE Core API (an https host under rce.roku.com, or 127.0.0.1, [::1] or localhost on any port, for testing). The default is https://api.rce.roku.com/api/v1. A value that is not a URL is reported by the variable's name, without echoing it. |
RK_RCE_NO_LIFECYCLE | Set to 1 by rk server in the processes it spawns: they use running RCE devices but never start or stop one. Not meant to be set by hand. |
All documented variables are listed on rk environment variables.
start
Summary
Start collecting logs.
Description
Start a log session for a device and telnet port, creating a persistent telnet connection and a circular buffer. Fails if a session is already active for the same device and port.
Usage
rk logs start [options]Examples
rk logs start
rk logs start --device "Living Room" --port 8086See also
- startLogSession (
POST /api/logs/start) - logs
list
Summary
List log sessions.
Description
List log sessions grouped by device, with per-port status and buffer usage. Pass --verbose for detailed metrics.
Usage
rk logs list [options]Examples
rk logs list
rk logs list --verboseSee also
- listLogSessions (
GET /api/logs/list) - logs
stop
Summary
Stop log sessions.
Description
Stop log sessions. Stopping a session disconnects the stream but keeps the buffer in memory. Without --all, stops the selected device's sessions: only the one on --port when it is given, otherwise every port for that device.
Usage
rk logs stop [options]Examples
rk logs stop --all
rk logs stop --device "Living Room" --allSee also
- stopLogSessions (
POST /api/logs/stop) - logs
get
Summary
Get last N log lines.
Description
Retrieve the last N log lines from a session's buffer. Without --output, prints them to stdout.
Usage
rk logs get [options]Examples
rk logs get --lines 100See also
search
Summary
Search buffered logs.
Description
Search buffered logs with JavaScript regular expressions. At least one pattern is required; multiple patterns are OR'd together. Matching is case-insensitive unless --case-sensitive is passed.
Usage
rk logs search <pattern> [<pattern> ...] [options]| Argument | Description | Required | Repeatable |
|---|---|---|---|
| pattern | JavaScript regular expression to match against buffered log lines. | yes | yes |
Examples
rk logs search "error" "warning" --lines 100See also
- searchLogs (
GET /api/logs/search) - logs
tail
Summary
Stream logs in real time.
Description
Stream logs in real time until Ctrl+C. The default source, console, streams the app's console from the rk server and accepts the rk logs options. --source firmware streams a Roku Cloud Emulator device's firmware log instead; see its section below.
Usage
rk logs tail [options]
rk logs tail --source firmware [--device rce:<name>] [--from-start]Options
| Flag | Value/type | Allowed values | Default | Required |
|---|---|---|---|---|
--source | console|firmware (string) | console, firmware | console | no |
--device | id|ip|name (string) | — | the active device | no |
--source
console streams the app's console through the rk server. firmware streams a Roku Cloud Emulator device's firmware log (system output, not the app's console) without a server.
--device
Target device, or rce:<name>.
Examples
rk logs tail
rk logs tail --prefixSee also
- tailLogs (
POST /api/logs/tail)
--source firmware
Summary
Stream a Roku Cloud Emulator device's firmware log without a server.
Description
Streams a Roku Cloud Emulator device's firmware log (system output, not the app's console) until Ctrl+C, without an rk server. Only --device and --from-start are accepted in this mode.
Usage
rk logs tail --source firmware [--device rce:<name>] [--from-start]Options
| Flag | Value/type | Default | Required |
|---|---|---|---|
--device | rce:name (string) | the active device | no |
--from-start | boolean | — | no |
--device
The rce:<name> device whose firmware log to stream.
--from-start
Begin with the lines the device already logged.
Examples
rk logs tail --source firmware --device rce:my-tv --from-startEnvironment variables
| Environment variable | Description |
|---|---|
RK_RCE_TOKEN | The Roku Cloud Emulator (RCE) token. When set, it takes precedence over the token saved by rk device set-rce-token. That suits CI, where the token comes from a masked variable. |
RK_RCE_API_URL | Points rk at another RCE Core API (an https host under rce.roku.com, or 127.0.0.1, [::1] or localhost on any port, for testing). The default is https://api.rce.roku.com/api/v1. A value that is not a URL is reported by the variable's name, without echoing it. |
RK_RCE_NO_LIFECYCLE | Set to 1 by rk server in the processes it spawns: they use running RCE devices but never start or stop one. Not meant to be set by hand. |
All documented variables are listed on rk environment variables.
ports
Summary
List known Roku log ports.
Description
Print the known Roku telnet log ports: 8085 for main device logs and 8086 for screensaver logs. Needs no rk server.
Usage
rk logs portsExamples
rk logs portsUpdated about 6 hours ago