Scratchpad Logs and Console Messages¶
This page describes how to retrieve the logs for your Scratchpad and how STDOUT and STDERR messages appear in the console.
Logs¶
Each user gets their own Scratchpad, which is a q process running in a Kubernetes pod (the container that hosts the Scratchpad). To retrieve logs for your Scratchpad, you first need the name of its pod.
Find your Scratchpad pod name¶
By default, kdb Insights Enterprise keeps scratchpads preprovisioned (the quickStartup property is enabled) so they can be immediately assigned to the next user who logs in. Because a preprovisioned pod is created before it is assigned, its name does not contain your username.
The reliable way to identify your Scratchpad pod is to run the following in the Scratchpad. In q, .z.h returns the host name, which in Kubernetes is the pod name:
.z.h
In Python, use the PyKX Python library to evaluate the same expression:
import pykx as kx
kx.q('.z.h')
Note
When quickStartup is disabled, scratchpad pods are instead named <release-name>-scratch-<first 7 characters of user name>-<hash> (for example, insights-scratch-jsmith-c5415851ba45a47c4f7c50bc418dae46-vdhcc).
Retrieve the logs¶
Use the pod name with the kxi obs logs command to retrieve the logs from the command line. This is available to users without direct Kubernetes access:
kxi obs logs --pod <pod-name>
See Retrieve Logs for more options for filtering log output.
If you have direct Kubernetes access, you can instead use kubectl get pod <pod-name> to get information about the pod:
NAME READY STATUS RESTARTS AGE
insights-scratch-jsmith-c5415851ba45a47c4f7c50bc418dae46-vdhcc 1/1 Running 0 15m
The output includes:
NAME: The name of the pod.READY: The number of containers in the pod that are ready (1/1).STATUS: The status of the pod (Running).RESTARTS: The number of times the pod has been restarted (0).AGE: How long the pod has been running (15m).
STDOUT and STDERR¶
Messages written to STDOUT or STDERR appear in all open consoles for the user. The system displays STDOUT messages with a blue background and STDERR messages with a red background.
Although STDERR messages look similar to the runtime errors shown when an expression fails, the interface labels them clearly with the title “STANDARD ERROR” to distinguish them.

The console can batch multiple writes to STDOUT or STDERR before displaying them. As a result, commands such as show each til 10 or for i in range(0, 10): print(i) can be displayed as a single output block rather than individual lines displayed incrementally.
Limitations
Log messages written using the qlog functions, such as log.info and log.warn, are not currently displayed in the console.
In q, messages written to the handles 1 and 2 are buffered and not displayed until a newline is logged. In contrast, messages written to -1 and -2 are logged immediately and appear without buffering.
Deprecation
The previous beta features of .com_kx_edi.getLogs and scratchpad_logs.get_logs have been removed, as logs are now streamed to the console automatically.