-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from amplication/task/fluent-bit
feat(fluent-bit): add chart basics & partial templated manifests
- Loading branch information
Showing
10 changed files
with
540 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v2 | ||
name: fluent-bit | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "1.16.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "fluent-bit.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "fluent-bit.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "fluent-bit.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "fluent-bit.labels" -}} | ||
helm.sh/chart: {{ include "fluent-bit.chart" . }} | ||
{{ include "fluent-bit.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "fluent-bit.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "fluent-bit.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "fluent-bit.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "fluent-bit.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: fluent-bit-role | ||
rules: | ||
- nonResourceURLs: | ||
- /metrics | ||
verbs: | ||
- get | ||
- apiGroups: [""] | ||
resources: | ||
- namespaces | ||
- pods | ||
- pods/logs | ||
- nodes | ||
- nodes/proxy | ||
verbs: ["get", "list", "watch"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: fluent-bit-role-binding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: fluent-bit-role | ||
subjects: | ||
- kind: ServiceAccount | ||
name: fluent-bit | ||
namespace: observability |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: fluent-bit-config | ||
namespace: observability | ||
data: | ||
fluent-bit.conf: | | ||
[SERVICE] | ||
Flush 5 | ||
Log_Level info | ||
Daemon off | ||
Parsers_File parsers.conf | ||
HTTP_Server ${HTTP_SERVER} | ||
HTTP_Listen 0.0.0.0 | ||
HTTP_Port ${HTTP_PORT} | ||
storage.path /var/fluent-bit/state/flb-storage/ | ||
storage.sync normal | ||
storage.checksum off | ||
storage.backlog.mem_limit 5M | ||
@INCLUDE application-log.conf | ||
@INCLUDE dataplane-log.conf | ||
@INCLUDE host-log.conf | ||
application-log.conf: | | ||
[INPUT] | ||
Name tail | ||
Tag application.* | ||
Exclude_Path /var/log/containers/cloudwatch-agent*, /var/log/containers/fluent-bit*, /var/log/containers/aws-node*, /var/log/containers/kube-proxy* | ||
Path /var/log/containers/*.log | ||
Docker_Mode On | ||
Docker_Mode_Flush 5 | ||
Docker_Mode_Parser container_firstline | ||
multiline.parser docker, cri | ||
DB /var/fluent-bit/state/flb_container.db | ||
Mem_Buf_Limit 50MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Rotate_Wait 30 | ||
storage.type filesystem | ||
Read_from_Head ${READ_FROM_HEAD} | ||
[INPUT] | ||
Name tail | ||
Tag application.* | ||
Path /var/log/containers/fluent-bit* | ||
Parser docker | ||
DB /var/fluent-bit/state/flb_log.db | ||
Mem_Buf_Limit 5MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Read_from_Head ${READ_FROM_HEAD} | ||
[INPUT] | ||
Name tail | ||
Tag application.* | ||
Path /var/log/containers/cloudwatch-agent* | ||
Docker_Mode On | ||
Docker_Mode_Flush 5 | ||
Docker_Mode_Parser cwagent_firstline | ||
Parser docker | ||
DB /var/fluent-bit/state/flb_cwagent.db | ||
Mem_Buf_Limit 5MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Read_from_Head ${READ_FROM_HEAD} | ||
[FILTER] | ||
Name kubernetes | ||
Match application.* | ||
Kube_URL https://kubernetes.default.svc:443 | ||
Kube_Tag_Prefix application.var.log.containers. | ||
Merge_Log On | ||
Merge_Log_Key log_processed | ||
K8S-Logging.Parser On | ||
K8S-Logging.Exclude Off | ||
Labels Off | ||
Annotations Off | ||
Use_Kubelet On | ||
Kubelet_Port 10250 | ||
Buffer_Size 0 | ||
[FILTER] | ||
Name parser | ||
Parser json | ||
Key_Name message | ||
[OUTPUT] | ||
Name cloudwatch_logs | ||
Match application.* | ||
region ${AWS_REGION} | ||
log_group_name /aws/containerinsights/${CLUSTER_NAME}/application | ||
log_stream_prefix ${HOST_NAME}- | ||
auto_create_group true | ||
extra_user_agent container-insights | ||
dataplane-log.conf: | | ||
[INPUT] | ||
Name systemd | ||
Tag dataplane.systemd.* | ||
Systemd_Filter _SYSTEMD_UNIT=docker.service | ||
Systemd_Filter _SYSTEMD_UNIT=kubelet.service | ||
DB /var/fluent-bit/state/systemd.db | ||
Path /var/log/journal | ||
Read_From_Tail ${READ_FROM_TAIL} | ||
[INPUT] | ||
Name tail | ||
Tag dataplane.tail.* | ||
Path /var/log/containers/aws-node*, /var/log/containers/kube-proxy* | ||
Docker_Mode On | ||
Docker_Mode_Flush 5 | ||
Docker_Mode_Parser container_firstline | ||
Parser docker | ||
DB /var/fluent-bit/state/flb_dataplane_tail.db | ||
Mem_Buf_Limit 50MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Rotate_Wait 30 | ||
storage.type filesystem | ||
Read_from_Head ${READ_FROM_HEAD} | ||
[FILTER] | ||
Name modify | ||
Match dataplane.systemd.* | ||
Rename _HOSTNAME hostname | ||
Rename _SYSTEMD_UNIT systemd_unit | ||
Rename MESSAGE message | ||
Remove_regex ^((?!hostname|systemd_unit|message).)*$ | ||
[FILTER] | ||
Name aws | ||
Match dataplane.* | ||
imds_version v1 | ||
[OUTPUT] | ||
Name cloudwatch_logs | ||
Match dataplane.* | ||
region ${AWS_REGION} | ||
log_group_name /aws/containerinsights/${CLUSTER_NAME}/dataplane | ||
log_stream_prefix ${HOST_NAME}- | ||
auto_create_group true | ||
extra_user_agent container-insights | ||
host-log.conf: | | ||
[INPUT] | ||
Name tail | ||
Tag host.dmesg | ||
Path /var/log/dmesg | ||
Parser syslog | ||
DB /var/fluent-bit/state/flb_dmesg.db | ||
Mem_Buf_Limit 5MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Read_from_Head ${READ_FROM_HEAD} | ||
[INPUT] | ||
Name tail | ||
Tag host.messages | ||
Path /var/log/messages | ||
Parser syslog | ||
DB /var/fluent-bit/state/flb_messages.db | ||
Mem_Buf_Limit 5MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Read_from_Head ${READ_FROM_HEAD} | ||
[INPUT] | ||
Name tail | ||
Tag host.secure | ||
Path /var/log/secure | ||
Parser syslog | ||
DB /var/fluent-bit/state/flb_secure.db | ||
Mem_Buf_Limit 5MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Read_from_Head ${READ_FROM_HEAD} | ||
[FILTER] | ||
Name aws | ||
Match host.* | ||
imds_version v1 | ||
[OUTPUT] | ||
Name cloudwatch_logs | ||
Match host.* | ||
region ${AWS_REGION} | ||
log_group_name /aws/containerinsights/${CLUSTER_NAME}/host | ||
log_stream_prefix ${HOST_NAME}. | ||
auto_create_group true | ||
extra_user_agent container-insights | ||
parsers.conf: | | ||
[PARSER] | ||
Name docker | ||
Format json | ||
Time_Key time | ||
Time_Format %Y-%m-%dT%H:%M:%S.%LZ | ||
[PARSER] | ||
Name syslog | ||
Format regex | ||
Regex ^(?<time>[^ ]* {1,2}[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$ | ||
Time_Key time | ||
Time_Format %b %d %H:%M:%S | ||
[PARSER] | ||
Name container_firstline | ||
Format regex | ||
Regex (?<log>(?<="log":")\S(?!\.).*?)(?<!\\)".*(?<stream>(?<="stream":").*?)".*(?<time>\d{4}-\d{1,2}-\d{1,2}T\d{2}:\d{2}:\d{2}\.\w*).*(?=}) | ||
Time_Key time | ||
Time_Format %Y-%m-%dT%H:%M:%S.%LZ | ||
[PARSER] | ||
Name cwagent_firstline | ||
Format regex | ||
Regex (?<log>(?<="log":")\d{4}[\/-]\d{1,2}[\/-]\d{1,2}[ T]\d{2}:\d{2}:\d{2}(?!\.).*?)(?<!\\)".*(?<stream>(?<="stream":").*?)".*(?<time>\d{4}-\d{1,2}-\d{1,2}T\d{2}:\d{2}:\d{2}\.\w*).*(?=}) | ||
Time_Key time | ||
Time_Format %Y-%m-%dT%H:%M:%S.%LZ | ||
[PARSER] | ||
# http://rubular.com/r/tjUt3Awgg4 | ||
Name cri | ||
Format regex | ||
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<message>.*)$ | ||
Time_Key time | ||
Time_Format %Y-%m-%dT%H:%M:%S.%L%z | ||
Decode_Field_As escaped message do_next | ||
Decode_Field_As json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: fluent-bit-cluster-info | ||
namespace: observability | ||
data: | ||
cluster.name: "{{ .Values.configmap.info.clusterName }}" | ||
logs.region: "{{ .Values.configmap.info.region }}" | ||
http.server: "{{ .Values.configmap.info.http.server }}" | ||
http.port: "{{ .Values.configmap.info.http.port }}" | ||
read.head: "{{ .Values.configmap.info.read.head }}" | ||
read.tail: "{{ .Values.configmap.info.read.tail }}" |
Oops, something went wrong.