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

Collapse multiline logs based on a start line. #7

Closed

Conversation

jeschkies
Copy link

Summary:
This is a very simple approach based on grafana#1380 to provide multiline
or block log entries in promtail.

A multiline stage is added to pipelines. This stages matches a start
line. Once a start line is matched all following lines are appended
to an entry and not passed on to downstream stages. Once a new start
line is matched the former block of multilines is sent.

If now new line arrives withing max_wait_time the block is flushed to
the next stage and a new block is started.

owen-d and others added 11 commits December 2, 2020 08:50
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
* doc: Add missing backticks

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>

* doc: Use absolute path to positions.yaml file

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>

* doc: Remove .. from URL paths

I'm not sure what the `..` means exactly.

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Introducing go pipelines to promtail.

Based off @jeschkies  idea.

WIP

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Fixes all tests.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* More tests and code cleanup.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Wip breaking things.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Fixing tests, adding Stop to the interface.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Fixes all tests.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Fixes more test.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Moar fixes for tests.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Close correctly client before reading.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Use defer.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Add some comments.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Fixes lint issues

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Attempt to fix journald without linux.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Fixes journald json test.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Add missing stop in the filetarget.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Update pkg/logentry/stages/match_test.go

Co-authored-by: Karsten Jeschkies <k@jeschkies.xyz>

* First set of feeback review fixes.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Use newEntry as suggested by Karsten.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Fix tests.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* lint.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

Co-authored-by: Karsten Jeschkies <k@jeschkies.xyz>
Summary:
This is a very simple approach based on grafana#1380 to provide multiline
or block log entries in promtail.

A `multiline` stage is added to pipelines. This stages matches a start
line. Once a start line is matched all following lines are appended
to an entry and not passed on to downstream stages. Once a new start
line is matched the former block of multilines is sent.

If now new line arrives withing `max_wait_time` the block is flushed to
the next stage and a new block is started.
@jeschkies
Copy link
Author

Moved to grafana#3024

@jeschkies jeschkies closed this Dec 3, 2020
jeschkies referenced this pull request in jeschkies/loki Dec 21, 2021
* linting, cleaning up

* CI: update golangci-lint version, remove go test -v flag

* linting, add gofumpt and golangci-lint to makefile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants