Documentation
Log template presets
Render structured process logs with reusable presets and local overrides.
When to use this
Use this pattern when services emit structured JSON or logfmt logs and the raw lines are too noisy for day-to-day terminal work.
Example
[global]
log_mode = "both"
log_format = "json"
[log_templates.rust]
[log_templates.rust.fields]
[[log_templates.rust.fields.fields]]
key = "level"
prefix = "["
suffix = "]"
map = { info = "INFO", warn = "WARN", error = "ERROR" }
color = "gold"
color_rules = [
{ regex = "^ERROR$", color = "red" },
{ regex = "^WARN$", color = "yellow" },
{ regex = "^INFO$", color = "green" },
]
[[log_templates.rust.fields.fields]]
key = "fields.message"
color = "mintcream"
[log_templates.email]
[log_templates.email.fields]
[[log_templates.email.fields.fields]]
key = "level"
prefix = "["
suffix = "]"
map = { info = "INFO", warn = "WARN", error = "ERROR" }
color = "gold"
[[log_templates.email.fields.fields]]
key = "fields.message"
color = "mintcream"
[[log_templates.email.fields.fields]]
prefix = "to "
key = "fields.to"
color = "brown"
[global.log_template]
stdout_preset = "rust"
stderr_preset = "rust"
[[process]]
name = "api-public"
command = "./tools/run_service.sh api-public"
[[process]]
name = "notifications-email-send"
command = "./tools/run_service.sh notifications-email-send"
[process.log_template]
stdout_preset = "email"
stderr_preset = "email"Why this works
The global template keeps most services readable with the same layout. A specific process can bind a different preset when it has fields that deserve special treatment, such as an email recipient.
File logs still keep the raw child output. Templates only affect rendered output in the console/TUI and history view.
Defaults involved here
fields.separator: effective default" "- field
format: effective defaultnone - field
visible_if: effective defaultalways preset,stdout_preset, andstderr_preset: default noneprocess.log_template: inheritsglobal.log_template
What to customize
- Replace field keys with the keys emitted by your logger.
- Keep a simple global preset for most services.
- Add specialized presets only when a service has meaningful extra fields.
- Use
color_rulesfor stable values such as levels or status codes.