2021-03-03 04:48:48 +08:00
|
|
|
# Loki Output Plugin
|
|
|
|
|
|
2022-04-21 23:45:47 +08:00
|
|
|
This plugin sends logs to Loki, using metric name and tags as labels, log line
|
|
|
|
|
will content all fields in `key="value"` format which is easily parsable with
|
|
|
|
|
`logfmt` parser in Loki.
|
2021-03-03 04:48:48 +08:00
|
|
|
|
2021-08-06 05:32:04 +08:00
|
|
|
Logs within each stream are sorted by timestamp before being sent to Loki.
|
|
|
|
|
|
2022-10-27 03:58:36 +08:00
|
|
|
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
|
|
|
|
|
|
|
|
|
In addition to the plugin-specific configuration settings, plugins support
|
|
|
|
|
additional global and plugin configuration settings. These settings are used to
|
|
|
|
|
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
|
|
|
|
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
|
|
|
|
|
2023-01-12 23:55:21 +08:00
|
|
|
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
2022-10-27 03:58:36 +08:00
|
|
|
|
2023-02-03 00:31:23 +08:00
|
|
|
## Secret-store support
|
|
|
|
|
|
|
|
|
|
This plugin supports secrets from secret-stores for the `username` and
|
|
|
|
|
`password` option.
|
|
|
|
|
See the [secret-store documentation][SECRETSTORE] for more details on how
|
|
|
|
|
to use them.
|
|
|
|
|
|
|
|
|
|
[SECRETSTORE]: ../../../docs/CONFIGURATION.md#secret-store-secrets
|
|
|
|
|
|
2021-11-25 02:47:33 +08:00
|
|
|
## Configuration
|
2021-03-03 04:48:48 +08:00
|
|
|
|
2022-05-25 22:48:59 +08:00
|
|
|
```toml @sample.conf
|
2021-03-03 04:48:48 +08:00
|
|
|
# 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"
|
2023-05-04 17:56:19 +08:00
|
|
|
|
|
|
|
|
## Metric Name Label
|
|
|
|
|
## Label to use for the metric name to when sending metrics. If set to an
|
|
|
|
|
## empty string, this will not add the label. This is NOT suggested as there
|
|
|
|
|
## is no way to differentiate between multiple metrics.
|
|
|
|
|
# metric_name_label = "__name"
|
2021-03-03 04:48:48 +08:00
|
|
|
```
|