Skip to content

Commit

Permalink
Add extraMount, extraVolumeMount to promtail helm chart for systemd-j…
Browse files Browse the repository at this point in the history
…ournal (grafana#1871)

This commit adds the variables extraMount and extraVolumeMount to the
promtail helm chart.

It also adds an example on how to use the helm chart with
systemd-journal support.
  • Loading branch information
Stefan Andres authored Mar 31, 2020
1 parent 1c133a9 commit 645f37c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
35 changes: 35 additions & 0 deletions production/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,41 @@ syslogService:
port: 1514
```
## Run promtail with systemd-journal support
In order to receive and process syslog message into promtail, the following changes will be necessary:
* Review the [promtail systemd-journal configuration documentation](/docs/clients/promtail/scraping.md#journal-scraping-linux-only)
* Configure the promtail helm chart with the systemd-journal configuration added to the `extraScrapeConfigs` section and volume mounts for the promtail pods to access the log files. For example:

```yaml
# Add additional scrape config
extraScrapeConfigs:
- job_name: journal
journal:
path: /var/log/journal
max_age: 12h
labels:
job: systemd-journal
relabel_configs:
- source_labels: ['__journal__systemd_unit']
target_label: 'unit'
- source_labels: ['__journal__hostname']
target_label: 'hostname'
# Mount journal directory into promtail pods
extraVolumes:
- name: journal
hostPath:
path: /var/log/journal
extraVolumeMounts:
- name: journal
mountPath: /var/log/journal
readOnly: true
```

## How to contribute

After adding your new feature to the appropriate chart, you can build and deploy it locally to test:
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: "v1"
name: loki-stack
version: 0.33.0
version: 0.33.1
appVersion: v1.3.0
kubeVersion: "^1.10.0-0"
description: "Loki: like Prometheus, but for logs."
Expand Down
2 changes: 1 addition & 1 deletion production/helm/promtail/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: "v1"
name: promtail
version: 0.19.2
version: 0.19.3
appVersion: v1.3.0
kubeVersion: "^1.10.0-0"
description: "Responsible for gathering logs and sending them to Loki"
Expand Down
6 changes: 6 additions & 0 deletions production/helm/promtail/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ spec:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
env:
{{- with .Values.env }}
{{- toYaml . | nindent 12 }}
Expand Down Expand Up @@ -118,3 +121,6 @@ spec:
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
6 changes: 6 additions & 0 deletions production/helm/promtail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ volumes:
hostPath:
path: /var/log/pods

# Custom volumes together with the default ones
extraVolumes: []

volumeMounts:
- name: docker
mountPath: /var/lib/docker/containers
Expand All @@ -104,6 +107,9 @@ volumeMounts:
mountPath: /var/log/pods
readOnly: true

# Custom volumeMounts together with the default ones
extraVolumeMounts: []

config:
client:
# Maximum wait period before sending batch
Expand Down

0 comments on commit 645f37c

Please sign in to comment.