Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana-cloud/send-data/alloy/reference/config-blocks/logging.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/send-data/alloy/reference/config-blocks/logging/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
logging
logging is an optional configuration block used to customize how Alloy produces log messages.
logging is specified without a label and can only be provided once per configuration file.
Usage
logging {
}Arguments
You can use the following arguments with logging:
| Name | Type | Description | Default | Required |
|---|---|---|---|---|
destination | string | Primary log destination. | See below | no |
format | string | Format to use for writing log lines. | "logfmt" | no |
level | string | Level at which log lines should be written. | "info" | no |
write_to | list(LogsReceiver) | List of receivers to send log entries to. | [] | no |
level
The following strings are recognized as valid log levels:
"error": Only write logs at the error level."warn": Only write logs at the warn level or above."info": Only write logs at info level or above."debug": Write all logs, including debug level logs.
format
The following strings are recognized as valid log line formats:
"json": Write logs as JSON objects."logfmt": Write logs aslogfmtlines.
write_to
The write_to argument allows Alloy to tee its log entries to one or more loki.* component log receivers in addition to the default location.
This, for example can be the export of a loki.write component to send log entries directly to Loki, or a loki.relabel component to add a certain label first.
destination
The following strings are recognized as valid log destinations:
"stderr": Write logs tostderr."windows_event_log": Windows only. Write logs to the Windows Event Log under the “Alloy” source.
The default value of destination is set to "windows_event_log" when Alloy runs as a Windows service.
Otherwise, destination defaults to "stderr".
Alloy fails to start if destination is set to "windows_event_log" and Alloy is not running on Windows.
Retrieve logs
You can retrieve the logs in different ways depending on your platform and installation method:
Linux:
- If you’re running Alloy with systemd, use
journalctl -u alloy.
Docker:
- If you’re running Alloy in a Docker container, use
docker logs CONTAINER_ID.
macOS:
- If you’re running Alloy with Homebrew as a service, use
brew services info grafana/grafana/alloyto check status andtail -f $(brew --prefix)/var/log/alloy.logfor logs. - If you’re running Alloy with launchd, use
log show --predicate 'process == "alloy"' --infoor check/usr/local/var/log/alloy.log. - If you’re running Alloy in a Docker container, use
docker logs CONTAINER_ID.
Windows:
- If you’re running Alloy as a Windows service, check the Windows Event Viewer under Windows Logs > Application for Alloy-related events.
- If you’re running Alloy that is manually installed, check the log files in
%PROGRAMDATA%\Grafana\Alloy\logs\or the directory specified in your configuration. - If you’re running Alloy in a Docker container, use
docker logs CONTAINER_ID.
All platforms:
- Alloy writes logs to
stderrif started directly without a service manager. Redirectstderrof the Alloy process to a file for logs to persist on disk.
Example
logging {
level = "info"
format = "logfmt"
}Was this page helpful?
Related resources from Grafana Labs


