Skip to content

Commit

Permalink
More template stage examples. (#2606)
Browse files Browse the repository at this point in the history
Add an example for the `Entry` key that can be used to reference the log line.
  • Loading branch information
cyriltovena authored Sep 10, 2020
1 parent 3669770 commit 19030e6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/sources/clients/promtail/stages/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 19030e6

Please sign in to comment.