Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

[logstash] Add support to use pattern files #883

Merged
merged 4 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
add support to use pattern files
  • Loading branch information
tuananhnguyen-ct committed Nov 2, 2020
commit d6f90fe4b37318e321ffd22ff6eed477a92761fd
2 changes: 2 additions & 0 deletions logstash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ useful for the [http input plugin][], for instance.
| `logstashConfig` | Allows you to add any config files in `/usr/share/logstash/config/` such as `logstash.yml` and `log4j2.properties` See [values.yaml][] for an example of the formatting | `{}` |
| `logstashJavaOpts` | Java options for Logstash. This is where you should configure the JVM heap size | `-Xmx1g -Xms1g` |
| `logstashPipeline` | Allows you to add any pipeline files in `/usr/share/logstash/pipeline/` | `{}` |
| `logstashPatternDir` | Allows you to define a custom directory to store patten files | `/usr/share/logstash/patterns/` |
| `logstashPipeline` | Allows you to add any pattern files in `logstashPatternDir` | `{}` |
tuananhnguyen-ct marked this conversation as resolved.
Show resolved Hide resolved
| `maxUnavailable` | The [maxUnavailable][] value for the pod disruption budget. By default this will prevent Kubernetes from having more than 1 unhealthy pod in the node group | `1` |
| `nameOverride` | Overrides the chart name for resources. If not set the name will default to `.Chart.Name` | `""` |
| `nodeAffinity` | Value for the [node affinity settings][] | `{}` |
Expand Down
17 changes: 17 additions & 0 deletions logstash/templates/configmap-pattern.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.logstashPattern }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "logstash.fullname" . }}-pattern
labels:
app: "{{ template "logstash.fullname" . }}"
chart: "{{ .Chart.Name }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
data:
{{- range $path, $config := .Values.logstashPattern }}
{{ $path }}: |
{{ tpl $config $ | indent 4 -}}
{{- end -}}
{{- end -}}
16 changes: 16 additions & 0 deletions logstash/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ spec:
{{- if .Values.logstashPipeline }}
pipelinechecksum: {{ include (print .Template.BasePath "/configmap-pipeline.yaml") . | sha256sum | trunc 63 }}
{{- end }}
{{- if .Values.logstashPattern }}
patternchecksum: {{ include (print .Template.BasePath "/configmap-pattern.yaml") . | sha256sum | trunc 63 }}
{{- end }}
{{- if .Values.secrets }}
secretschecksum: {{ include (print .Template.BasePath "/secret.yaml") . | sha256sum | trunc 63 }}
{{- end }}
Expand Down Expand Up @@ -127,6 +130,11 @@ spec:
configMap:
name: {{ template "logstash.fullname" . }}-pipeline
{{- end }}
{{- if .Values.logstashPattern }}
- name: logstashpattern
configMap:
name: {{ template "logstash.fullname" . }}-pattern
{{- end }}
{{- if .Values.extraVolumes }}
{{ tpl .Values.extraVolumes . | indent 8 }}
{{- end }}
Expand Down Expand Up @@ -188,6 +196,14 @@ spec:
mountPath: /usr/share/logstash/pipeline/{{ $path }}
subPath: {{ $path }}
{{- end -}}
{{- if .Values.logstashPattern }}
{{- $logstashPatternDir := .Values.logstashPatternDir -}}
{{- range $path, $config := .Values.logstashPattern }}
- name: logstashpattern
mountPath: {{ $logstashPatternDir }}{{ $path }}
subPath: {{ $path }}
{{- end -}}
{{- end -}}
{{- if .Values.extraVolumeMounts }}
{{ tpl .Values.extraVolumeMounts . | indent 10 }}
{{- end }}
Expand Down
6 changes: 6 additions & 0 deletions logstash/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ logstashPipeline: {}
# }
# output { stdout { } }

# Allows you to add any pattern files in your custom pattern dir
logstashPatternDir: "/usr/share/logstash/patterns/"
logstashPattern: {}
# pattern.conf: |
# DPKG_VERSION [-+~<>\.0-9a-zA-Z]+

# Extra environment variables to append to this nodeGroup
# This will be appended to the current 'env:' key. You can use any of the kubernetes env
# syntax here
Expand Down