Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(stage): add docker and cri #1091

Merged
merged 3 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/clients/promtail/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ given log entry.

Parsing stages:

* [docker](./stages/docker.md): Extract data by parsing the log line as docker format.
* [cri](./stages/cri.md): Extract data by parsing the log line as cri format.
* [regex](./stages/regex.md): Extract data using a regular expression.
* [json](./stages/json.md): Extract data by parsing the log line as JSON.

Expand Down
41 changes: 41 additions & 0 deletions docs/clients/promtail/stages/cri.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# `cri` stage

The `cri` stage is a parsing stage that reads the log line as the way that cri generated.

## Format

Each log from cri is string format and covert following three parts:
1. `log`: the content of log
2. `stream`: stdout/stderr
3. `time`: the timestamp string of log

Each part is splited with blank with others and no blanks in each part.

So in the following logs, only the first is cri format which `cri` stage can format:
```
"2019-01-01T01:00:00.000000001Z stderr P test\ngood"
"2019-01-01 T01:00:00.000000001Z stderr testgood"
"2019-01-01T01:00:00.000000001Z testgood"
```

More case refer to [entry_parser_test](../../../../pkg/promtail/api/entry_parser_test.go).

## Examples

### Using log line

```yaml
cri: {}
```

Given the following log line:

```
"2019-04-30T02:12:41.8443515Z stdout xx message"
```

The following key-value pairs would be created in the set of extracted data:

- `output`: `message`
- `stream`: `stdout`
- `timestamp`: `2019-04-30T02:12:41.8443515`
31 changes: 31 additions & 0 deletions docs/clients/promtail/stages/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# `docker` stage

The `docker` stage is a parsing stage that reads the log line as the way that docker generated.
It works similar with `json` stage but no need to set anything.

## Format

Each log from docker is json format and covert following three keys:
1. `log`: the content of log
2. `stream`: stdout/stderr
3. `time`: the timestamp string of log

## Examples

### Using log line

```yaml
docker: {}
```

Given the following log line:

```
{"log":"log message\n","stream":"stderr","time":"2019-04-30T02:12:41.8443515Z"}
```

The following key-value pairs would be created in the set of extracted data:

- `output`: `log message\n`
- `stream`: `stderr`
- `timestamp`: `2019-04-30T02:12:41.8443515`