2021-03-03 04:48:48 +08:00
|
|
|
# Loki Output Plugin
|
|
|
|
|
|
2021-11-09 05:47:32 +08:00
|
|
|
This plugin sends logs to Loki, using metric name and tags as labels,
|
2021-03-03 04:48:48 +08:00
|
|
|
log line will content all fields in `key="value"` format which is easily parsable with `logfmt` parser in Loki.
|
|
|
|
|
|
2021-08-06 05:32:04 +08:00
|
|
|
Logs within each stream are sorted by timestamp before being sent to Loki.
|
|
|
|
|
|
2021-03-03 04:48:48 +08:00
|
|
|
### Configuration:
|
|
|
|
|
|
|
|
|
|
```toml
|
|
|
|
|
# A plugin that can transmit logs to Loki
|
|
|
|
|
[[outputs.loki]]
|
|
|
|
|
## The domain of Loki
|
|
|
|
|
domain = "https://loki.domain.tld"
|
|
|
|
|
|
|
|
|
|
## Endpoint to write api
|
|
|
|
|
# endpoint = "/loki/api/v1/push"
|
|
|
|
|
|
|
|
|
|
## Connection timeout, defaults to "5s" if not set.
|
|
|
|
|
# timeout = "5s"
|
|
|
|
|
|
|
|
|
|
## Basic auth credential
|
|
|
|
|
# username = "loki"
|
|
|
|
|
# password = "pass"
|
|
|
|
|
|
|
|
|
|
## Additional HTTP headers
|
|
|
|
|
# http_headers = {"X-Scope-OrgID" = "1"}
|
|
|
|
|
|
|
|
|
|
## If the request must be gzip encoded
|
|
|
|
|
# gzip_request = false
|
|
|
|
|
|
|
|
|
|
## Optional TLS Config
|
|
|
|
|
# tls_ca = "/etc/telegraf/ca.pem"
|
|
|
|
|
# tls_cert = "/etc/telegraf/cert.pem"
|
|
|
|
|
# tls_key = "/etc/telegraf/key.pem"
|
|
|
|
|
```
|