loki.source.heroku
loki.source.heroku listens for Heroku messages over TCP connections and forwards them to other loki.* components.
The component starts a new Heroku listener for the given listener block and fans out incoming entries to the list of receivers in forward_to.
Before using loki.source.heroku, Heroku should be configured with the URL where Alloy is listening.
Follow the steps in Heroku HTTPS Drain docs for using the Heroku CLI with a command like the following:
heroku drains:add [http|https]://HOSTNAME:PORT/heroku/api/v1/drain -a HEROKU_APP_NAMEYou can specify multiple loki.source.heroku components by giving them different labels.
Usage
loki.source.heroku "<LABEL>" {
http {
listen_address = "<LISTEN_ADDRESS>"
listen_port = "<LISTEN_PORT>"
}
forward_to = <RECEIVER_LIST>
}Arguments
You can use the following arguments with loki.source.heroku:
The relabel_rules field can make use of the rules export value from a loki.relabel component to apply one or more relabeling rules to log entries before they’re forwarded to the list of receivers in forward_to.
Blocks
You can use the following blocks with loki.source.heroku:
The > symbol indicates deeper levels of nesting.
For example, http > tls refers to a tls block defined inside an http block.
grpc
The grpc block configures the gRPC server.
You can use the following arguments to configure the grpc block. Any omitted fields take their default values.
http
The http block configures the HTTP server.
You can use the following arguments to configure the http block. Any omitted fields take their default values.
tls
The tls block configures TLS for the HTTP and gRPC servers.
The following pairs of arguments are mutually exclusive and can’t both be set simultaneously:
cert_pemandcert_filekey_pemandkey_file
When configuring client authentication, both the client certificate (using cert_pem or cert_file) and the client key (using key_pem or key_file) must be provided.
Labels
The labels map is applied to every message that the component reads.
The following internal labels all prefixed with __ are available but are discarded if not relabeled:
__heroku_drain_app__heroku_drain_host__heroku_drain_log_id__heroku_drain_proc
All URL query parameters are translated to __heroku_drain_param_<name>
If the X-Scope-OrgID header is set it’s translated to __tenant_id__
Exported fields
loki.source.heroku doesn’t export any fields.
Component health
loki.source.heroku is only reported as unhealthy if given an invalid
configuration.
Debug information
loki.source.heroku exposes some debug information per Heroku listener:
- Whether the listener is currently running.
- The listen address.
Debug metrics
loki_source_heroku_drain_entries_total(counter): Number of successful entries received by the Heroku target.loki_source_heroku_drain_parsing_errors_total(counter): Number of parsing errors while receiving Heroku messages.
Example
This example listens for Heroku messages over TCP in the specified port and forwards them to a loki.write component using the Heroku timestamp.
loki.source.heroku "local" {
http {
listen_address = "0.0.0.0"
listen_port = 4040
}
use_incoming_timestamp = true
labels = {component = "loki.source.heroku"}
forward_to = [loki.write.local.receiver]
}
loki.write "local" {
endpoint {
url = "loki:3100/api/v1/push"
}
}When using the default http block settings, the server listen for new connection on port 8080.
loki.source.heroku "local" {
use_incoming_timestamp = true
labels = {component = "loki.source.heroku"}
forward_to = [loki.write.local.receiver]
}
loki.write "local" {
endpoint {
url = "loki:3100/api/v1/push"
}
}Compatible components
loki.source.heroku 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.