* add a config called `include_fields` which lets you allowlist a specific set of fields which will be mapped to labels and sent to Loki.
Signed-off-by: Edward Welch <edward.welch@grafana.com>
* update docs
Signed-off-by: Edward Welch <edward.welch@grafana.com>
* restore path for Dockerfile so it works in CI
Signed-off-by: Edward Welch <edward.welch@grafana.com>
[batch_wait => number | default = 1(s) | required=false]
@ -106,6 +108,8 @@ Contains a `message` and `@timestamp` fields, which are respectively used to for
All other fields (except nested fields) will form the label set (key value pairs) attached to the log line. [This means you're responsible for mutating and dropping high cardinality labels](https://grafana.com/blog/2020/04/21/how-labels-in-loki-can-make-log-queries-faster-and-easier/) such as client IPs.
You can usually do so by using a [`mutate`](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html) filter.
**Note:** In version 1.1.0 and greater of this plugin you can also specify a list of labels to allowlist via the `include_fields` configuration.
For example the configuration below :
```conf
@ -204,6 +208,10 @@ If using the [GrafanaLab's hosted Loki](https://grafana.com/products/cloud/), th
Message field to use for log lines. You can use logstash key accessor language to grab nested property, for example : `[log][message]`.
#### include_fields
An array of fields which will be mapped to labels and sent to Loki, when this list is configured **only** these fields will be sent, all other fields will be ignored.
#### batch_wait
Interval in seconds to wait before pushing a batch of records to Loki. This means even if the [batch size](#batch_size) is not reached after `batch_wait` a partial batch will be sent, this is to ensure freshness of the data.
@ -259,7 +267,7 @@ filter {
}
}
mutate {
remove_field => ["tags"]
remove_field => ["tags"] # Note: with include_fields defined below this wouldn't be necessary