Skip to content

Commit 6511360

Browse files
authored
Add documentation for file output (#119)
1 parent 3d84865 commit 6511360

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/operators/file_output.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## `file_output` operator
2+
3+
The `file_output` operator will write log entries to a file. By default, they will be written as JSON-formatted lines, but if a `Format` is provided, that format will be used as a template to render each log line
4+
5+
### Configuration Fields
6+
7+
| Field | Default | Description |
8+
| --- | --- | --- |
9+
| `id` | `file_output` | A unique identifier for the operator |
10+
| `path` | required | A path to write the entries to |
11+
| `format` | | A [go template](https://golang.org/pkg/text/template/) that will be used to render each entry into a log line |
12+
13+
14+
### Example Configurations
15+
16+
#### Simple configuration
17+
18+
Configuration:
19+
```yaml
20+
- type: file_output
21+
path: /tmp/output.json
22+
```
23+
24+
#### Custom format
25+
26+
Configuration:
27+
```yaml
28+
- type: file_output
29+
path: /tmp/output.log
30+
format: "Time: {{.Timestamp}} Record: {{.Record}}\n"
31+
```

0 commit comments

Comments
 (0)