Need to change the message format for multiple sources?
You can also configure the format in Sources -> Configure -> Advanced settings, by using bulk updates in the Sources list, or using the Update Source API.
Logs & traces output of each source can be customized in Logs & traces by clicking on the ⋯
icon next to the Message column header and selecting Configure:
The Logs & traces message format is a freeform text template with columns wrapped in {column}
brackets.
LEVEL: {level}, PID: {context.system.pid}, THREAD: {context.runtime.thread_id}
Conditional rendering can be achieved by piping multiple values
LEVEL: {level}, THREAD or PID: {context.runtime.thread_id|context.system.pid}
If you have special characters in your fields such as dots, you can use square brackets instead:
LEVEL: {level}, THREAD: {context["thread.id"]}
You can also configure the format in Sources -> Configure -> Advanced settings, by using bulk updates in the Sources list, or using the Update Source API.
You can format and color your logs using a subset of ANSI codes in your log messages.
For example, this is how you could format your logs using our JavaScript client:
logger.info("Logs can be \u001B[1mbold\u001B[0m, \u001B[31mred\u001B[0m, or \u001B[1;32mbold green\u001B[0m.");
Here's the result you would see in Logs & traces:
Logs & traces supports 31-36
and 91-96
code ranges for colors in both light and dark themes.
1
2
3
4
Each font color or style needs to be reset by reset all modes
(0
) ANSI code. Better Stack Logs & traces doesn't support resetting a color or a style by starting a new one.
Logs & traces automatically recognizes and renders ANSI color codes in your main message content. However, when you want to display colors in other fields (like custom fields, context data, or structured log properties), you need to explicitly tell Logs & traces to treat them as text that may contain color formatting.
Use the ::text
syntax to enable color rendering in non-message fields:
{custom.msg::text}
When using coalescing (the |
operator), add ::text
at the end of the entire field expression:
{message_json.msg|message::text}
Note that ::text
applies to the whole coalesced field, not individual parts.
You can customize your Logs & traces view by clicking the gear icon in the upper right corner.
For example, you can hide the histogram on the top of the page, make the layout denser, or change the way longer log messages are displayed:
We use cookies to authenticate users, improve the product user experience, and for marketing.