Welcome to the new Golem Cloud Docs! 👋
Documentation
Operate
Logs

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 (opens in a new tab) 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 (opens in a new tab).

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

For logging from workers running on Golem, there are two options:

Using the WASI Logging interface depends on the guest language - for example for Rust, there is a crate providing bindings for the standard log crate as described on the Building Components in Rust page.

Getting worker logs

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

To connect to a worker's log with golem-cli, use either the golem-cli worker connect command or the --connect flag when making an invocation. See the CLI documentation for more details.