Skip to content

Commit b99b31c

Browse files
committed
Add integrated log forwarding system
1 parent 1ecdd90 commit b99b31c

10 files changed

Lines changed: 60 additions & 6 deletions

charts/bunkerweb/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 1.0.10
18+
version: 1.0.11
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/bunkerweb/templates/_helpers.tpl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,4 +814,16 @@ Generate BunkerWeb feature environment variables
814814
value: {{ .backup.backupDirectory | quote }}
815815
{{- end }}
816816
{{- end }}
817-
{{- end }}
817+
{{- end }}
818+
819+
{{/*
820+
Syslog address for UI logs
821+
Returns the configured syslog address if set, otherwise the UI sidecar service address
822+
*/}}
823+
{{- define "bunkerweb.syslogAddress" -}}
824+
{{- if and .Values.ui.logs.syslogAddress (ne .Values.ui.logs.syslogAddress "") -}}
825+
{{- .Values.ui.logs.syslogAddress -}}
826+
{{- else -}}
827+
{{- printf "ui-%s.%s.svc.%s:514" (include "bunkerweb.fullname" .) (include "bunkerweb.namespace" .) .Values.settings.kubernetes.domainName -}}
828+
{{- end -}}
829+
{{- end -}}

charts/bunkerweb/templates/bunkerweb-daemonset.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ spec:
6767
# Internal subnet(s) + localhost
6868
- name: API_WHITELIST_IP
6969
value: "{{ .Values.settings.misc.apiWhitelistIp }}"
70+
{{- if .Values.ui.logs.enabled }}
71+
- name: ACCESS_LOG_1
72+
value: "syslog:server={{ include "bunkerweb.syslogAddress" . }},tag=bunkerweb_access"
73+
- name: ERROR_LOG_1
74+
value: "syslog:server={{ include "bunkerweb.syslogAddress" . }},tag=bunkerweb"
75+
{{- end }}
7076
{{- if .Values.bunkerweb.extraEnvs }}
7177
{{- toYaml .Values.bunkerweb.extraEnvs | nindent 12 }}
7278
{{- end }}

charts/bunkerweb/templates/bunkerweb-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ spec:
8585
# Internal subnet(s) + localhost
8686
- name: API_WHITELIST_IP
8787
value: "{{ .Values.settings.misc.apiWhitelistIp }}"
88+
{{- if .Values.ui.logs.enabled }}
89+
- name: ACCESS_LOG_1
90+
value: "syslog:server={{ include "bunkerweb.syslogAddress" . }},tag=bunkerweb_access"
91+
- name: ERROR_LOG_1
92+
value: "syslog:server={{ include "bunkerweb.syslogAddress" . }},tag=bunkerweb"
93+
{{- end }}
8894
{{- if .Values.bunkerweb.extraEnvs }}
8995
{{- toYaml .Values.bunkerweb.extraEnvs | nindent 12 }}
9096
{{- end }}

charts/bunkerweb/templates/bunkerweb-statefulset.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ spec:
5555
value: "{{ .Values.settings.misc.dnsResolvers }}"
5656
- name: API_WHITELIST_IP
5757
value: "{{ .Values.settings.misc.apiWhitelistIp }}"
58+
{{- if .Values.ui.logs.enabled }}
59+
- name: ACCESS_LOG_1
60+
value: "syslog:server={{ include "bunkerweb.syslogAddress" . }},tag=bunkerweb_access"
61+
- name: ERROR_LOG_1
62+
value: "syslog:server={{ include "bunkerweb.syslogAddress" . }},tag=bunkerweb"
63+
{{- end }}
5864
{{- if .Values.bunkerweb.extraEnvs }}
5965
{{- toYaml .Values.bunkerweb.extraEnvs | nindent 12 }}
6066
{{- end }}

charts/bunkerweb/templates/controller-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ spec:
6363
{{- if .Values.controller.extraEnvs }}
6464
{{- toYaml .Values.controller.extraEnvs | nindent 12 }}
6565
{{- end }}
66+
{{- if .Values.ui.logs.enabled }}
67+
- name: LOG_TYPES
68+
value: "stderr syslog"
69+
- name: LOG_SYSLOG_ADDRESS
70+
value: "{{ include "bunkerweb.syslogAddress" . }}"
71+
{{- end }}
6672
{{- if .Values.controller.nodeSelector }}
6773
{{- with .Values.controller.nodeSelector }}
6874
nodeSelector:

charts/bunkerweb/templates/scheduler-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ spec:
9090
{{- if .Values.scheduler.extraEnvs }}
9191
{{- toYaml .Values.scheduler.extraEnvs | nindent 12 }}
9292
{{- end }}
93+
{{- if .Values.ui.logs.enabled }}
94+
- name: LOG_TYPES
95+
value: "stderr syslog"
96+
- name: LOG_SYSLOG_ADDRESS
97+
value: "{{ include "bunkerweb.syslogAddress" . }}"
98+
{{- end }}
9399
{{- if .Values.scheduler.nodeSelector }}
94100
{{- with .Values.scheduler.nodeSelector }}
95101
nodeSelector:

charts/bunkerweb/templates/ui-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ spec:
8888
{{- else }}
8989
value: "{{ .Values.settings.ui.flaskSecret }}"
9090
{{- end }}
91+
{{- if .Values.ui.logs.enabled }}
92+
- name: LOG_TYPES
93+
value: "stderr syslog"
94+
- name: LOG_SYSLOG_ADDRESS
95+
value: "{{ include "bunkerweb.syslogAddress" . }}"
96+
{{- end }}
9197
- name: OVERRIDE_ADMIN_CREDS
9298
value: "{{ .Values.settings.ui.overrideAdminCreds }}"
9399
{{- if .Values.ui.extraEnvs }}

charts/bunkerweb/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,11 @@ ui:
986986
# Enable log collection sidecar
987987
enabled: false
988988

989+
# Syslog address for log forwarding
990+
# Automatically set to Sidecar service if empty
991+
# Format: HOST:PORT "syslog-server:514" do not append Protocol, it's set to UDP by default and port 514.
992+
syslogAddress: ""
993+
989994
# Syslog-ng container for log collection
990995
repository: balabit/syslog-ng
991996
pullPolicy: Always

docs/values.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Main reverse proxy and WAF component
6666
| `bunkerweb.repository` | Container image configuration | `string` | `"bunkerity/bunkerweb"` |
6767
| `bunkerweb.securityContext` | Security context for BunkerWeb container | `object` | See nested values |
6868
| `bunkerweb.service` | Internal service configuration (for inter-pod communication) | `object` | See nested values |
69-
| `bunkerweb.tag` | Configuration for tag | `string` | `"1.6.5"` |
69+
| `bunkerweb.tag` | Configuration for tag | `string` | `"1.6.6"` |
7070
| `bunkerweb.tolerations` | Tolerations (overrides global setting) | `list` | `[]` |
7171
| `bunkerweb.volumeMounts` | volumes: - name: shared-data persistentVolumeClaim: claimName: shared-pvc Custom volume mounts confi... | `list` | `[]` |
7272
| `bunkerweb.volumes` | Custom volumes configuration Allows mounting additional volumes to the BunkerWeb container | `list` | `[]` |
@@ -127,7 +127,7 @@ Web interface for BunkerWeb management and monitoring
127127
| `ui.readinessProbe` | Readiness probe configuration | `object` | See nested values |
128128
| `ui.repository` | Container image configuration | `string` | `"bunkerity/bunkerweb-ui"` |
129129
| `ui.securityContext` | Security context for BunkerWeb container | `object` | See nested values |
130-
| `ui.tag` | Configuration for tag | `string` | `"1.6.5"` |
130+
| `ui.tag` | Configuration for tag | `string` | `"1.6.6"` |
131131
| `ui.tolerations` | Tolerations (overrides global setting) | `list` | `[]` |
132132
| `ui.livenessProbe.exec` | Configuration for exec | `object` | See nested values |
133133
| `ui.livenessProbe.failureThreshold` | Configuration for failureThreshold | `int` | `3` |
@@ -138,6 +138,7 @@ Web interface for BunkerWeb management and monitoring
138138
| `ui.logs.persistence` | Persistent storage for logs | `object` | See nested values |
139139
| `ui.logs.pullPolicy` | Configuration for pullPolicy | `string` | `"Always"` |
140140
| `ui.logs.repository` | Syslog-ng container for log collection | `string` | `"balabit/syslog-ng"` |
141+
| `ui.logs.syslogAddress` | Syslog address for log forwarding Automatically set to Sidecar service if empty Format: HOST:PORT "s... | `string` | `""` |
141142
| `ui.logs.tag` | Configuration for tag | `string` | `"4.8.0"` |
142143
| `ui.readinessProbe.exec` | Configuration for exec | `object` | See nested values |
143144
| `ui.readinessProbe.failureThreshold` | Configuration for failureThreshold | `int` | `3` |
@@ -174,7 +175,7 @@ Manages BunkerWeb configuration and coordination
174175
| `scheduler.pullPolicy` | Configuration for pullPolicy | `string` | `"Always"` |
175176
| `scheduler.repository` | Container image configuration | `string` | `"bunkerity/bunkerweb-scheduler"` |
176177
| `scheduler.securityContext` | Security context for BunkerWeb container | `object` | See nested values |
177-
| `scheduler.tag` | Configuration for tag | `string` | `"1.6.5"` |
178+
| `scheduler.tag` | Configuration for tag | `string` | `"1.6.6"` |
178179
| `scheduler.tolerations` | Tolerations (overrides global setting) | `list` | `[]` |
179180
| `scheduler.usePrometheusExporter` | Enable Prometheus metrics exporter and creates a service for it Requires BunkerWeb PRO license | `bool` | `false` |
180181
| `scheduler.features.antibot` | Configuration for antibot | `object` | See nested values |
@@ -380,7 +381,7 @@ Kubernetes controller for automatic Ingress management
380381
| `controller.readinessProbe` | Readiness probe configuration | `object` | See nested values |
381382
| `controller.repository` | Container image configuration | `string` | `"bunkerity/bunkerweb-autoconf"` |
382383
| `controller.securityContext` | Security context for BunkerWeb container | `object` | See nested values |
383-
| `controller.tag` | Configuration for tag | `string` | `"1.6.5"` |
384+
| `controller.tag` | Configuration for tag | `string` | `"1.6.6"` |
384385
| `controller.tolerations` | Tolerations (overrides global setting) | `list` | `[]` |
385386
| `controller.livenessProbe.exec` | Configuration for exec | `object` | See nested values |
386387
| `controller.livenessProbe.failureThreshold` | Configuration for failureThreshold | `int` | `3` |

0 commit comments

Comments
 (0)