Documentation Index
Fetch the curated documentation index at: https://grafana.com/llms.txt
Fetch the complete documentation index at: https://grafana.com/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: https://grafana.com/docs/grafana-cloud/send-data/alloy/reference/components/loki/loki.source.gelf.md (append .md) or send Accept: text/markdown to https://grafana.com/docs/grafana-cloud/send-data/alloy/reference/components/loki/loki.source.gelf/. For the curated documentation index, use https://grafana.com/llms.txt. For the complete documentation index, use https://grafana.com/llms-full.txt.
loki.source.gelf
loki.source.gelf reads Graylog Extended Long Format (GELF) logs from a UDP listener and forwards them to other loki.* components.
You can specify multiple loki.source.gelf components by giving them different labels and ports.
Usage
loki.source.gelf "<LABEL>" {
forward_to = <RECEIVER_LIST>
}Arguments
The component starts a new UDP listener and fans out log entries to the list of receivers passed in forward_to.
You can use the following arguments with loki.source.gelf:
| Name | Type | Description | Default | Required |
|---|---|---|---|---|
forward_to | list(LogsReceiver) | List of receivers to send log entries to. | yes | |
listen_address | string | UDP address and port to listen for Graylog messages. | "0.0.0.0:12201" | no |
relabel_rules | RelabelRules | Relabeling rules to apply on log entries. | {} | no |
use_incoming_timestamp | bool | When false, assigns the current timestamp to the log when it was processed | false | no |
Note
GELF logs can be sent uncompressed or compressed with GZIP or ZLIB. A
joblabel is added with the full name of the componentloki.source.gelf.LABEL.
The relabel_rules argument can make use of the rules export from a loki.relabel component to apply one or more relabeling rules to log entries before they’re forwarded to the list of receivers specified in forward_to.
Incoming messages have the following internal labels available:
__gelf_message_facility: The GELF facility.__gelf_message_version: The GELF message version sent by the client.__gelf_message_host: The host sending the GELF message.__gelf_message_level: The GELF level as a string.
All labels starting with __ are removed prior to forwarding log entries.
To keep these labels, relabel them using a loki.relabel component and pass its rules export to the relabel_rules argument.
Blocks
The loki.source.gelf component doesn’t support any blocks. You can configure this component with arguments.
Component health
loki.source.gelf is only reported as unhealthy if given an invalid configuration.
Debug Metrics
gelf_target_entries_total(counter): Total number of successful entries sent to the GELF target.gelf_target_parsing_errors_total(counter): Total number of parsing errors while receiving GELF messages.
Example
loki.relabel "gelf" {
rule {
source_labels = ["__gelf_message_host"]
target_label = "host"
}
}
loki.source.gelf "listen" {
forward_to = [loki.write.endpoint.receiver]
relabel_rules = loki.relabel.gelf.rules
}
loki.write "endpoint" {
endpoint {
url ="loki:3100/api/v1/push"
}
}Compatible components
loki.source.gelf can accept arguments from the following components:
- Components that export Loki
LogsReceiver
Note
Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.
Was this page helpful?
Related resources from Grafana Labs


