More template stage examples. (#2606)

Add an example for the `Entry` key that can be used to reference the log line.
pull/2620/head
Cyril Tovena 5 years ago committed by GitHub
parent 3669770c07
commit 19030e6dc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      docs/sources/clients/promtail/stages/template.md

@ -99,6 +99,18 @@ function](https://golang.org/pkg/strings/#Replace). When the template executes,
the entire contents of the `app` key from the extracted map will have at most
`1` instance of `loki` changed to `blokey`.
A special key named `Entry` can be used to reference the current line, this can be useful when you need to append/prepend the log line.
```yaml
- template:
source: message
template: '{{.app }}: {{ .Entry }}'
- output:
source: message
```
The snippet above will for instance prepend the log line with the application name.
## Supported Functions
### ToLower & ToUpper

Loading…
Cancel
Save