Skip to content

Commit

Permalink
Updating helm/ksonnet to use new pipeline config
Browse files Browse the repository at this point in the history
Updating docs
Rebase fixes
  • Loading branch information
slim-bean committed May 8, 2019
1 parent 3d94603 commit 2c4e30f
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Once you have promtail, Loki, and Grafana running, continue with [our usage docs

- [API documentation](./docs/api.md) for alternative ways of getting logs into Loki.
- [Operations](./docs/operations.md) for important aspects of running Loki.
- [Promtail](./docs/promtail-setup.md) on how to configure the agent that tails your logs.
- [Promtail](./docs/promtail.md) is an agent which can tail your log files and push them to Loki.
- [Logcli](./docs/logcli.md) on how to query your logs without Grafana.
- [Troubleshooting](./docs/troubleshooting.md) for help around frequent error messages.
- [Usage](./docs/usage.md) for how to set up a Loki datasource in Grafana and query your logs.
Expand Down
22 changes: 14 additions & 8 deletions docs/promtail-examples.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# promtail examples
#### In this file you can see simple examples of configure promtail
# Promtail Config Examples

* This example of config promtail based on original docker [config](https://github.com/grafana/loki/blob/master/cmd/promtail/promtail-docker-config.yaml)
## Pipeline Examples

TODO Need pipeline examples

## Simple Docker Config

This example of config promtail based on original docker [config](https://github.com/grafana/loki/blob/master/cmd/promtail/promtail-docker-config.yaml)
and show how work with 2 and more sources:

Filename for example: my-docker-config.yaml
Expand Down Expand Up @@ -38,18 +43,19 @@ scrape_configs:
__path__: /srv/log/someone_service/*.log
```
##### Description
Scrape_config section of config.yaml contents are various jobs for parsing your logs on current host
#### Description

Scrape_config section of config.yaml contents contains various jobs for parsing your logs

`job` and `host` these are tags on which you can filter parsed logs date on Grafana later
`job` and `host` are examples of static labels added to all logs, labels are indexed by Loki and are used to help search logs.

`__path__` it is path to directory where stored your logs.

If you run promtail and this config.yaml in Docker container, don't forget use docker volumes for mapping real directories
with log to those folders in the container.

* See next example of Dockerfile, who use our modified promtail config (my-docker-config.yaml)
1) Create folder, for example `promtail`, then new folder build and in this filder conf and place there `my-docker-config.yaml`.
#### Example Use
1) Create folder, for example `promtail`, then new sub directory `build/conf` and place there `my-docker-config.yaml`.
2) Create new Dockerfile in root folder `promtail`, with contents
```
FROM grafana/promtail:latest
Expand Down
6 changes: 2 additions & 4 deletions docs/promtail-setup.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Promtail Setups

## Design Documentation

* [Extracting labels from logs](./design/labels.md)

## Daemonset method

Daemonset will deploy promtail on every node within the kubernetes cluster.
Expand All @@ -12,6 +8,8 @@ Daemonset deployment is great to collect all of the container logs within the
cluster. It is great solution for single tenant. All of the logs will send to a
single Loki server.

Check the `production` folder for examples of a daemonset deployment for kubernetes using both helm and ksonnet.

### Example
```yaml
---Daemonset.yaml
Expand Down
11 changes: 11 additions & 0 deletions docs/promtail.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Promtail

* [Deployment Methods](./promtail-setup.md)
* [Config and Usage Examples](./promtail-examples.md)
* [Troubleshooting](./troubleshooting.md)


## Design Documentation

* [Extracting labels from logs](./design/labels.md)

## Promtail and scrape_configs

Promtail is an agent which reads log files and sends streams of log data to
Expand Down
2 changes: 1 addition & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The promtail configuration contains a `__path__` entry to a directory that promt

## Connecting to a promtail pod to troubleshoot

Say you are missing logs from your nginx pod and want to investigate promtail.
First check *Troubleshooting targets* section above, if that doesn't help answer your questions you can connect to the promtail pod to further investigate.

In your cluster if you are running promtail as a daemonset, you will have a promtail pod on each node, to figure out which promtail you want run:

Expand Down
1 change: 0 additions & 1 deletion pkg/promtail/promtail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/stretchr/testify/assert"

"github.com/grafana/loki/pkg/logproto"
"github.com/grafana/loki/pkg/parser"
"github.com/grafana/loki/pkg/promtail/api"
"github.com/grafana/loki/pkg/promtail/config"
"github.com/grafana/loki/pkg/promtail/scrape"
Expand Down
27 changes: 15 additions & 12 deletions production/helm/promtail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ annotations: {}

deploymentStrategy: RollingUpdate

entryParser: docker

image:
repository: grafana/promtail
tag: latest
Expand Down Expand Up @@ -124,8 +122,9 @@ config:
# Period to resync directories being watched and files being tailed
sync_period: 10s
scrape_configs:
- entry_parser: '{{ .Values.entryParser }}'
job_name: kubernetes-pods-name
- job_name: kubernetes-pods-name
pipeline_stages:
- docker: {}
kubernetes_sd_configs:
- role: pod
relabel_configs:
Expand Down Expand Up @@ -166,8 +165,9 @@ config:
- __meta_kubernetes_pod_uid
- __meta_kubernetes_pod_container_name
target_label: __path__
- entry_parser: '{{ .Values.entryParser }}'
job_name: kubernetes-pods-app
- job_name: kubernetes-pods-app
pipeline_stages:
- docker: {}
kubernetes_sd_configs:
- role: pod
relabel_configs:
Expand Down Expand Up @@ -212,8 +212,9 @@ config:
- __meta_kubernetes_pod_uid
- __meta_kubernetes_pod_container_name
target_label: __path__
- entry_parser: '{{ .Values.entryParser }}'
job_name: kubernetes-pods-direct-controllers
- job_name: kubernetes-pods-direct-controllers
pipeline_stages:
- docker: {}
kubernetes_sd_configs:
- role: pod
relabel_configs:
Expand Down Expand Up @@ -264,8 +265,9 @@ config:
- __meta_kubernetes_pod_uid
- __meta_kubernetes_pod_container_name
target_label: __path__
- entry_parser: '{{ .Values.entryParser }}'
job_name: kubernetes-pods-indirect-controller
- job_name: kubernetes-pods-indirect-controller
pipeline_stages:
- docker: {}
kubernetes_sd_configs:
- role: pod
relabel_configs:
Expand Down Expand Up @@ -318,8 +320,9 @@ config:
- __meta_kubernetes_pod_uid
- __meta_kubernetes_pod_container_name
target_label: __path__
- entry_parser: '{{ .Values.entryParser }}'
job_name: kubernetes-pods-static
- job_name: kubernetes-pods-static
pipeline_stages:
- docker: {}
kubernetes_sd_configs:
- role: pod
relabel_configs:
Expand Down
4 changes: 3 additions & 1 deletion production/ksonnet/promtail/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
external_labels: {},
}],
container_root_path: '/var/lib/docker',
entry_parser: 'docker',
pipeline_stages: [{
docker: {},
}],
},
},
}
2 changes: 1 addition & 1 deletion production/ksonnet/promtail/scrape_config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local config = import 'config.libsonnet';
config + {
local gen_scrape_config(job_name, pod_uid) = {
job_name: job_name,
entry_parser: $._config.promtail_config.entry_parser,
pipeline_stages: $._config.promtail_config.pipeline_stages,
kubernetes_sd_configs: [{
role: 'pod',
}],
Expand Down

0 comments on commit 2c4e30f

Please sign in to comment.