fluentd-elasticsearch
by kfirfer
A Fluentd Helm chart for Kubernetes with Elasticsearch output
About this chart
Fluentd Elasticsearch
- Installs Fluentd log forwarder.
TL;DR
helm repo add kokuwa https://kokuwaio.github.io/helm-charts
helm install kokuwa/fluentd-elasticsearch
Introduction
This chart bootstraps a Fluentd daemonset on a Kubernetes cluster using the Helm package manager.
It's meant to be a drop in replacement for fluentd-gcp on GKE which sends logs to Google Stackdriver, but can also be used in other places where logging to ElasticSearch is required.
The used Docker image (Dockerfile) also contains the following plugins:
- Detect exceptions (for Java multiline stacktraces)
- Kubernetes metadata filter
- Prometheus exporter
- Systemd
Prerequisites
- Kubernetes 1.16+ with Beta APIs enabled
Installing the Chart
To install the chart with the release name my-release:
helm install --name my-release kokuwa/fluentd-elasticsearch
The command deploys fluentd-elasticsearch on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.
Uninstalling the Chart
To uninstall the my-release deployment:
helm uninstall my-release
The command removes all the Kubernetes components associated with the chart and deletes the release.
Configuration
The following table lists the configurable parameters of the Fluentd elasticsearch chart and their default values.
| Parameter | Description | Default |
|---|---|---|
affinity | Optional daemonset affinity | {} |
annotations | Optional daemonset annotations | NULL |
podAnnotations | Optional daemonset's pods annotations | NULL |
securityContext | Optional a security context for a Pod | {} |
configMaps.useDefaults.systemConf | Use default system.conf | true |
configMaps.useDefaults.containersInputConf | Use default containers.input.conf | true |
configMaps.useDefaults.containersKeepTimeKey | Keep the container log timestamp as part of the log data. | false |
configMaps.useDefaults.kubernetesMetadataFilterConfig | Set arbitrary configuration key-value pairs for the kubernetes_metadata filter. | {} |
configMaps.useDefaults.systemInputConf | Use default system.input.conf | true |
configMaps.useDefaults.forwardInputConf | Use default forward.input.conf | true |
configMaps.useDefaults.monitoringConf | Use default monitoring.conf | true |
configMaps.useDefaults.outputConf | Use default output.conf | true |
extraConfigMaps | Add additional Configmap or overwrite disabled default | {} |
elasticsearch.auth.enabled | Elasticsearch Auth enabled | false |
elasticsearch.auth.user | Elasticsearch Auth User | null |
elasticsearch.auth.password | Elasticsearch Auth Password | null |
elasticsearch.auth.existingSecret.name | Name of secret | null |
elasticsearch.auth.existingSecret.key | Key within secret containing password | null |
elasticsearch.setOutputHostEnvVar | Use elasticsearch.hosts (Disable this to manually configure hosts) | true |
elasticsearch.hosts | Elasticsearch Hosts List (host and port) | ["elasticsearch-client:9200"] |
elasticsearch.includeTagKey | Elasticsearch Including of Tag key | true |
elasticsearch.logstash.enabled | Elasticsearch Logstash enabled (supersedes indexName) | true |
elasticsearch.logstash.prefix | Elasticsearch Logstash prefix | logstash |
elasticsearch.logstash.prefixSeparator | Elasticsearch Logstash prefix separator | - |
elasticsearch.logstash.dateformat | Elasticsearch Logstash strftime format to generate index target index name | %Y.%m.%d |
elasticsearch.ilm.enabled | Elasticsearch Index Lifecycle Management enabled | false |
elasticsearch.ilm.policy_id | Elasticsearch ILM policy ID | logstash-policy |
elasticsearch.ilm.policy | Elasticsearch ILM policy to create | {} |
elasticsearch.ilm.policies | Elasticsearch ILM policies to create, map of policy IDs and policies | {} |
elasticsearch.ilm.policy_overwrite | Elastichsarch ILM policy overwrite | false |
elasticsearch.template.enabled | Elastichsarch Template enabled | false |
elasticsearch.template.name | Elastichsarch Template Name | fluentd-template |
elasticsearch.template.file | Elasticsearch Template FileName (inside the daemonset) | fluentd-template.json |
elasticsearch.template.content | Elasticsearch Template Content | see values.yaml |
elasticsearch.template.overwrite | Elasticsearch Template Overwrite (update even if it already exists) | false |
elasticsearch.template.useLegacy | Use legacy Elasticsearch template | true |
elasticsearch.indexName | Elasticsearch Index Name | fluentd |
elasticsearch.path | Elasticsearch Path | "" |
elasticsearch.scheme | Elasticsearch scheme setting | http |
elasticsearch.sslVerify | Elasticsearch Auth SSL verify | true |
elasticsearch.sslVersion | Elasticsearch tls version setting | TLSv1_2 |
elasticsearch.outputType | Elasticsearch output type | elasticsearch |
elasticsearch.typeName | Elasticsearch type name | _doc |
elasticsearch.logLevel | Elasticsearch global log level | info |
elasticsearch.log400Reason | Elasticsearch Log 400 reason | false |
elasticsearch.reconnectOnError | Elasticsearch Reconnect on error | true |
elasticsearch.reloadOnFailure | Elasticsearch Reload on failure | false |
elasticsearch.reloadConnections | Elasticsearch reload connections | false |
elasticsearch.requestTimeout | Elasticsearch request timeout | 5s |
elasticsearch.suppressTypeName | Elasticsearch type name suppression (for ES >= 7) | false |
elasticsearch.includeTimestamp | Elasticsearch Include timestamp (param used only if logstash is disabled) | false |
elasticsearch.buffer.enabled | Elasticsearch Buffer enabled | true |
elasticsearch.buffer.chunkKeys | Elasticsearch Buffer comma-separated chunk keys | "" |
elasticsearch.buffer.type | Elasticsearch Buffer type | file |
elasticsearch.buffer.path | Elasticsearch Buffer path | /var/log/fluentd-buffers/kubernetes.system.buffer |
elasticsearch.buffer.flushMode | Elasticsearch Buffer flush mode | interval |
elasticsearch.buffer.retryType | Elasticsearch Buffer retry type | exponential_backoff |
elasticsearch.buffer.flushThreadCount | Elasticsearch Buffer flush thread count | 2 |
| `elasticsearch.b |
Deploy fluentd-elasticsearch with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has fluentd-elasticsearch on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartfluentd-elasticsearch is pinned at v13.9.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply