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

Pipe data to Promtail #1649

Merged
merged 12 commits into from
Feb 11, 2020
Merged

Pipe data to Promtail #1649

merged 12 commits into from
Feb 11, 2020

Conversation

cyriltovena
Copy link
Contributor

Based on @slim-bean idea, this implements pipe support for promtail. I think this is a great way to quickly test Loki and Promtail.

Example:

cat my.log |  promtail --client.url http://127.0.0.1:3100/loki/api/v1/push --client.external-labels=k1=v1,k2=v2

See the doc for more informations.

I'm thinking about following this PR with another one to support --dry-run in promtail to prints streams instead of sending to Loki.

@@ -3,6 +3,53 @@
This document describes known failure modes of `promtail` on edge cases and the
adopted trade-offs.

## Pipe data to Promtail

Promtail supports piping data for sending logs to Loki. This is a very useful way to troubleshooting your configuration.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slim-bean Feel free to reword here. Also should this gets its own page ? I think for now having it in troubleshooting is fine.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
@cyriltovena cyriltovena mentioned this pull request Feb 6, 2020
Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small suggestion, but otherwise looks good to me. One caveat: I'm not incredibly familiar with these code paths.

docs/clients/promtail/troubleshooting.md Outdated Show resolved Hide resolved
cyriltovena and others added 3 commits February 7, 2020 14:35
Co-Authored-By: Owen Diehl <ow.diehl@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
@codecov-io
Copy link

codecov-io commented Feb 8, 2020

Codecov Report

Merging #1649 into master will increase coverage by 0.1%.
The diff coverage is 63.72%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1649     +/-   ##
========================================
+ Coverage   61.69%   61.8%   +0.1%     
========================================
  Files         109     110      +1     
  Lines        8308    8396     +88     
========================================
+ Hits         5126    5189     +63     
- Misses       2786    2808     +22     
- Partials      396     399      +3
Impacted Files Coverage Δ
pkg/promtail/targets/manager.go 0% <0%> (ø) ⬆️
pkg/promtail/targets/stdin_target_manager.go 72.46% <72.46%> (ø)
pkg/promtail/promtail.go 72.72% <83.33%> (+1.29%) ⬆️
pkg/logql/evaluator.go 92.78% <0%> (+1.03%) ⬆️
pkg/promtail/targets/filetarget.go 70.55% <0%> (+1.84%) ⬆️
pkg/promtail/targets/tailer.go 75.86% <0%> (+4.59%) ⬆️

@cyriltovena cyriltovena merged commit 814cc87 into grafana:master Feb 11, 2020
billimek added a commit to billimek/loki that referenced this pull request Feb 13, 2020
* 'extraPorts' of github.com:billimek/loki: (25 commits)
  Ensure status codes are set correctly in the frontend. (grafana#1684)
  --dry-run Promtail. (grafana#1652)
  Fix logcli --quiet parameter parsing issue (grafana#1682)
  This improves the log ouput for statistics in the logcli. (grafana#1644)
  Loki stack helm chart can deploy datasources without Grafana (grafana#1688)
  Automatically prune metrics from the /metrics output of the promtail metrics pipeline stage after an idle period.
  Allow a metric defined as a counter to match all lines, useful for creating line count metrics which include all your labels. Found a bug in the the test runner where it didn't fail if the actual error was nil but the test expected an error Added some tests to the counters to test valid configs
  maintainer links & usernames (grafana#1675)
  Binary operators in LogQL (grafana#1662)
  Pipe data to Promtail (grafana#1649)
  Add Owen to the maintainer team. (grafana#1673)
  Update tanka.md so that promtail.yml is in the correct format (grafana#1671)
  Correcte syntax of rate example (grafana#1641)
  Frontend & Querier query statistics instrumentation. (grafana#1661)
  loki-canary: fix indent of DaemonSet manifest written in .md file (grafana#1648)
  Query frontend service should be headless. (grafana#1665)
  Support custom prefix name in metrics stage (grafana#1664)
  pkg/promtail/positions: handle empty positions file (grafana#1660)
  Convert second(Integer class) to nanosecond precision (grafana#1656)
  Unite docs for fluentd plugin (grafana#1634)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants