rpk transform logs

View logs for a transform.

Data transform’s STDOUT and STDERR are captured during runtime and written to an internally managed topic _redpanda.transform_logs.

This command outputs logs for a single transform over a period of time and printing them to STDOUT. The logs can be printed in various formats.

By default, only logs that have been emitted are displayed. Use the --follow flag to stream new logs continuously.

Filtering

The --head and --tail flags are mutually exclusive and limit the number of log entries from the beginning or end of the range, respectively.

The --since and --until flags define a time range. Use one or both flags to limit the log output to a desired period of time.

Both flags accept values in the following formats:

Value Description

now

the current time, useful for --since=now

13 digits

parsed as a Unix millisecond

9 digits

parsed as a Unix second

YYYY-MM-DD

parsed as a day, UTC

YYYY-MM-DDTHH:MM:SSZ

parsed as RFC3339, UTC; fractional seconds optional (.MMM)

-dur

a negative duration from now

dur

a positive duration from now

Durations are parsed simply:

Value Description

3ms

three milliseconds

10s

ten seconds

9m

nine minutes

1h

one hour

1m3ms

one minute and three milliseconds

Formatting

Logs can be displayed in a variety of formats using --format.

The default --format=text prints the log record’s body line by line.

When --format=wide is specified, the output includes a prefix that is the date of the log line and a level for the record. The INFO level corresponds to being emitted on the transform’s STDOUT, while the WARN level is used for STDERR.

The --format=json flag emits logs in the JSON encoded version of the Open Telemetry LogRecord protocol buffer.

Examples

Reads logs within the last hour:

rpk transform logs --since=-1h

Reads logs prior to 30 minutes ago:

rpk transform logs --until=-30m

The following command reads logs between noon and 1pm on March 12th:

rpk transform logs my-transform --since=2024-03-12T12:00:00Z --until=2024-03-12T13:00:00Z

Usage

rpk transform logs NAME [flags]

Aliases

logs, log

Flags

Value Type Description

-f, --follow

-

Specify if the logs should be streamed.

--format

string

Output format (json,yaml,text,wide,help) (default "text").

--head

int

The number of log entries to fetch from the start.

-h, --help

-

Help for logs.

--since

timestamp

Start reading logs after this time (now, -10m, 2024-02-10). See Filtering for format details.

--tail

int

The number of log entries to fetch from the end.

--until

timestamp

Read logs up unto this time (-1h, 2024-02-10T13:00:00Z). See Filtering for format details.

--config

string

Redpanda or rpk config file; default search paths are /var/lib/redpanda/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml.

-X, --config-opt

stringArray

Override rpk configuration settings; '-X help' for detail or '-X list' for terser detail.

--profile

string

rpk profile to use.

-v, --verbose

-

Enable verbose logging.