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

FlagValue/typeAllowed valuesDefaultRequired
--deviceid|ip|name (string)—the active deviceno
--hostip|hostname (string)——no
--passwordpassword (string)——no
--portnumber (number)—8085no
--buffer-sizelines (number)—10000no
--linesnumber (number)—50 for get, 100 for searchno
--outputfile (string)——no
--formattxt|json (string)txt, jsontxtno
--case-sensitiveboolean——no
--allboolean——no
--prefixboolean——no
--appendboolean——no
--verboseboolean——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 variableDescription
RK_RCE_TOKENThe 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_URLPoints 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_LIFECYCLESet 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 8086

See also

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 --verbose

See also

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" --all

See also

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 100

See 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]
ArgumentDescriptionRequiredRepeatable
patternJavaScript regular expression to match against buffered log lines.yesyes

Examples

rk logs search "error" "warning" --lines 100

See also

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

FlagValue/typeAllowed valuesDefaultRequired
--sourceconsole|firmware (string)console, firmwareconsoleno
--deviceid|ip|name (string)—the active deviceno

--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 --prefix

See also

--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

FlagValue/typeDefaultRequired
--devicerce:name (string)the active deviceno
--from-startboolean—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-start

Environment variables

Environment variableDescription
RK_RCE_TOKENThe 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_URLPoints 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_LIFECYCLESet 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 ports

Examples

rk logs ports

Did this page help you?