logstash

by joaquinito2051

Helm chartv1.10.0App 6.7.0

Logstash is an open source, server-side data processing pipeline

About this chart

Logstash

Logstash is an open source, server-side data processing pipeline that ingests data from a multitude of sources simultaneously, transforms it, and then sends it to your favorite “stash.”

TL;DR;

$ helm install <helm-repo>/logstash

$ helm install stable/logstash

Installing the Chart

To install the chart with the release name my-release:

$ helm install --name my-release <helm-repo>/logstash

$ helm install --name my-release stable/logstash

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes nearly all the Kubernetes components associated with the chart and deletes the release.

Best Practices

Release and tune this chart once per Logstash pipeline

To achieve multiple pipelines with this chart, current best practice is to maintain one pipeline per chart release. In this way configuration is simplified and pipelines are more isolated from one another.

Default Pipeline: Beats Input -> Elasticsearch Output

Current best practice for ELK logging is to ship logs from hosts using Filebeat to logstash where persistent queues are enabled. Filebeat supports structured (e.g. JSON) and unstructured (e.g. log lines) log shipment.

Load Beats-generated index template into Elasticsearch

To best utilize the combination of Beats, Logstash and Elasticsearch, load Beats-generated index templates into Elasticsearch as described here.

On a remote-to-Kubernetes Linux instance you might run the following command to load that instance's Beats-generated index template into Elasticsearch (Elasticsearch hostname will vary).

filebeat setup --template -E output.logstash.enabled=false \
  -E 'output.elasticsearch.hosts=["elasticsearch.cluster.local:9200"]'

Links

Please review the following links that expound on current best practices.

  • https://www.elastic.co/blog/structured-logging-filebeat
  • https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-template.html
  • https://www.elastic.co/guide/en/logstash/current/deploying-and-scaling.html
  • https://www.elastic.co/guide/en/logstash/current/persistent-queues.html

Configuration

The following table lists the configurable parameters of the chart and its default values.

ParameterDescriptionDefault
replicaCountNumber of replicas1
podDisruptionBudgetPod disruption budgetmaxUnavailable: 1
updateStrategyUpdate strategytype: RollingUpdate
image.repositoryContainer image namedocker.elastic.co/logstash/logstash-oss
image.tagContainer image tag6.7.0
image.pullPolicyContainer image pull policyIfNotPresent
service.typeService type (ClusterIP, NodePort or LoadBalancer)ClusterIP
service.annotationsService annotations{}
service.portsPorts exposed by servicebeats
service.loadBalancerIPThe load balancer IP for the serviceunset
service.clusterIPThe cluster IP for the serviceunset
service.nodePortThe nodePort for the serviceunset
service.externalTrafficPolicySet externalTrafficPolicyunset
portsPorts exposed by logstash containerbeats
ingress.enabledEnables Ingressfalse
ingress.annotationsIngress annotations{}
ingress.pathIngress path/
ingress.hostsIngress accepted hostnames["logstash.cluster.local"]
ingress.tlsIngress TLS configuration[]
logstashJavaOptsJava options for logstash like heap size"-Xmx1g -Xms1g"
resourcesPod resource requests & limits{}
priorityClassNamepriorityClassNamenil
nodeSelectorNode selector{}
tolerationsTolerations[]
affinityAffinity or Anti-Affinity{}
podAnnotationsPod annotations{}
podLabelsPod labels{}
extraEnvExtra pod environment variables[]
livenessProbeLiveness probe settings for logstash container(see values.yaml)
readinessProbeReadiness probe settings for logstash container(see values.yaml)
persistence.enabledEnable persistencetrue
persistence.storageClassStorage class for PVCsunset
persistence.accessModeAccess mode for PVCsReadWriteOnce
persistence.sizeSize for PVCs2Gi
volumeMountsVolume mounts to configure for logstash container(see values.yaml)
volumesVolumes to configure for logstash container[]
terminationGracePeriodSecondsDuration the pod needs to terminate gracefully30
exporter.logstashPrometheus logstash-exporter settings(see values.yaml)
exporter.logstash.enabledEnables Prometheus logstash-exporterfalse
elasticsearch.hostElasticSearch hostnameelasticsearch-client.default.svc.cluster.local
elasticsearch.portElasticSearch port9200
configLogstash configuration key-values(see values.yaml)
patternsLogstash patterns configurationnil
filesLogstash custom files configurationnil
binaryFilesLogstash custom binary filesnil
inputsLogstash inputs configurationbeats
filtersLogstash filters configurationnil
outputsLogstash outputs configurationelasticsearch
securityContext.fsGroupGroup ID for the container1000
securityContext.runAsUserUser ID for the container1000

Deploy logstash with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has logstash 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartlogstash is pinned at v1.10.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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