Skip to Content

Logs

Golem server logs

Every Golem service emits structured logs with with configurable format and level. The default configuration for our dockerized builds is to log to the container’s standard output using JSON format. Each service supports the same set of configuration keys controlling the logging behavior, which can be overwritten using environment variables.

The default log level and filtering can be configured using the RUST_LOG environment variable, as described in the tracing-subscriber  crate’s documentation. The simplest way to use this environment variable is to set a global log level, for example RUST_LOG=debug.

The Golem specific config keys are the following:

[tracing] console = false dtor_friendly = false file_name = "worker-executor.log" file_truncate = true [tracing.file] ansi = false compact = false enabled = false json = true json_flatten = true json_flatten_span = true pretty = false span_events_active = false span_events_full = false without_time = false [tracing.stdout] ansi = true compact = false enabled = true json = false json_flatten = true json_flatten_span = true pretty = false span_events_active = false span_events_full = false without_time = false

Overwriting config

To overwrite any of the above config keys using environment variables, use the GOLEM_ prefix and the __ separator for levels. For example to disable logging to the standard output, and instead enable logging to a file, set the following two variables:

GOLEM_TRACING__FILE__ENABLED=true GOLEM_TRACING__STDOUT__ENABLED=false

Configurable options

The top-level tracing block allows setting the file name and truncate behavior for file logging, as well as enabling connection to tokio-console.

For both file and stdout logging, a set of boolean flags control the format of the emitted log lines:

FlagDescription
ansiUse ANSI colors for the output
compactUse the compact formatter.
enabledEnables logging to file or stdout
jsonUse JSON logging
json_flattenFlatten event metadata
json_flatten_spanFlatten nested span fields
prettyUse the pretty formatter
span_events_activeEmit one event per enter/exit of a span
span_events_fullEmit one event at all points (new, enter, exit, drop)
without_timeDo not emit timestamps for the log entries

Golem agent logs

In TypeScript agents, use the standard console API to log messages. console.log writes to the agent’s standard output, console.error writes to standard error, while console.debug, console.info, console.warn, etc. write log entries with the corresponding log level.

Getting agent logs

Agent logs (both stdout/err and WASI logging entries) are persisted for each agent, and they can be watched in live by using the connect API. There are two ways to connect to an agent:

  • Using golem
  • Using the connect WebSocket API To connect to an agent’s log with golem, use the golem agent stream command, or simply use golem agent invoke which streams logs by default. See the CLI documentation for more details.
Last updated on