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

[promtail] support multiple clients via clients #1425

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all 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: 1 addition & 1 deletion charts/promtail/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: promtail
description: Promtail is an agent which ships the contents of local logs to a Loki instance
type: application
appVersion: 2.5.0
version: 4.2.1
version: 5.0.0
home: https://grafana.com/loki
sources:
- https://github.com/grafana/loki
Expand Down
18 changes: 8 additions & 10 deletions charts/promtail/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# promtail

![Version: 4.2.1](https://img.shields.io/badge/Version-4.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.5.0](https://img.shields.io/badge/AppVersion-2.5.0-informational?style=flat-square)
![Version: 5.0.0](https://img.shields.io/badge/Version-5.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.5.0](https://img.shields.io/badge/AppVersion-2.5.0-informational?style=flat-square)

Promtail is an agent which ships the contents of local logs to a Loki instance

Expand Down Expand Up @@ -67,12 +67,11 @@ The new release which will pick up again from the existing `positions.yaml`.
| affinity | object | `{}` | Affinity configuration for pods |
| annotations | object | `{}` | Annotations for the DaemonSet |
| config | object | See `values.yaml` | Section for crafting Promtails config file. The only directly relevant value is `config.file` which is a templated string that references the other values and snippets below this key. |
| config.clients | list | See `values.yaml` | The config of clients of the Promtail server Must be reference in `config.file` to configure `clients` |
| config.file | string | See `values.yaml` | Config file contents for Promtail. Must be configured as string. It is templated so it can be assembled from reusable snippets in order to avoid redundancy. |
| config.logLevel | string | `"info"` | The log level of the Promtail server Must be reference in `config.file` to configure `server.log_level` See default config in `values.yaml` |
| config.lokiAddress | string | `"http://loki-gateway/loki/api/v1/push"` | The Loki address to post logs to. Must be reference in `config.file` to configure `client.url`. See default config in `values.yaml` |
| config.serverPort | int | `3101` | The port of the Promtail server Must be reference in `config.file` to configure `server.http_listen_port` See default config in `values.yaml` |
| config.snippets | object | See `values.yaml` | A section of reusable snippets that can be reference in `config.file`. Custom snippets may be added in order to reduce redundancy. This is especially helpful when multiple `kubernetes_sd_configs` are use which usually have large parts in common. |
| config.snippets.extraClientConfigs | list | empty | You can put here any keys that will be directly added to the config file's 'client' block. |
| config.snippets.extraRelabelConfigs | list | `[]` | You can put here any additional relabel_configs to "kubernetes-pods" job |
| config.snippets.extraScrapeConfigs | string | empty | You can put here any additional scrape configs you want to add to the config file. |
| containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true}` | The security context for containers |
Expand Down Expand Up @@ -241,18 +240,17 @@ config:
pushserver: push1
```

### Extra client config options
### Customize client config options

If you want to add additional options to the `client` section of promtail's config, please use
the `extraClientConfigs` section. For example, to enable HTTP basic auth and include OrgID
header, you can use:
By default, promtail send logs scraped to `loki` server at `http://loki-gateway/loki/api/v1/push`.
If you want to customize clients or add additional options to `loki`, please use the `clients` section. For example, to enable HTTP basic auth and include OrgID header, you can use:

```yaml
config:
snippets:
extraClientConfigs: |
clients:
- url: http://loki.server/loki/api/v1/push
tenant_id: 1
basic_auth:
username: loki
password: secret
tenant_id: 1
```
13 changes: 6 additions & 7 deletions charts/promtail/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,17 @@ config:
pushserver: push1
```

### Extra client config options
### Customize client config options

If you want to add additional options to the `client` section of promtail's config, please use
the `extraClientConfigs` section. For example, to enable HTTP basic auth and include OrgID
header, you can use:
By default, promtail send logs scraped to `loki` server at `http://loki-gateway/loki/api/v1/push`.
If you want to customize clients or add additional options to `loki`, please use the `clients` section. For example, to enable HTTP basic auth and include OrgID header, you can use:

```yaml
config:
snippets:
extraClientConfigs: |
clients:
- url: http://loki.server/loki/api/v1/push
tenant_id: 1
basic_auth:
username: loki
password: secret
tenant_id: 1
```
18 changes: 6 additions & 12 deletions charts/promtail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,11 @@ config:
# Must be reference in `config.file` to configure `server.http_listen_port`
# See default config in `values.yaml`
serverPort: 3101
# -- The Loki address to post logs to.
# Must be reference in `config.file` to configure `client.url`.
# See default config in `values.yaml`
lokiAddress: http://loki-gateway/loki/api/v1/push
# -- The config of clients of the Promtail server
# Must be reference in `config.file` to configure `clients`
# @default -- See `values.yaml`
clients:
- url: http://loki-gateway/loki/api/v1/push
# -- A section of reusable snippets that can be reference in `config.file`.
# Custom snippets may be added in order to reduce redundancy.
# This is especially helpful when multiple `kubernetes_sd_configs` are use which usually have large parts in common.
Expand Down Expand Up @@ -294,10 +295,6 @@ config:
# This helps debug the Promtail config.
addScrapeJobLabel: false

# -- You can put here any keys that will be directly added to the config file's 'client' block.
# @default -- empty
extraClientConfigs: []

# -- You can put here any additional scrape configs you want to add to the config file.
# @default -- empty
extraScrapeConfigs: ""
Expand Down Expand Up @@ -351,10 +348,7 @@ config:
http_listen_port: {{ .Values.config.serverPort }}

clients:
- url: {{ tpl .Values.config.lokiAddress . }}
{{- with .Values.config.snippets.extraClientConfigs }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- toYaml .Values.config.clients | nindent 2 }}

positions:
filename: /run/promtail/positions.yaml
Expand Down