logstash

by SVTECH-NMAA

Helm chartv1.0.6App v1.0.0Verified publisher

logstash

About this chart

Logstash Chart

Multi-vendor syslog ingestion for the NMAA stack. Logstash terminates syslog listeners for Juniper (Junos), H3C (Comware), Huawei (VRP) and Fortinet (FortiOS) devices, plus a Beats listener for offline log bundles uploaded by Rundeck, normalises each vendor format with grok/kv/translate filters, and writes to per-vendor Elasticsearch indices managed by the elasticsearch chart's ILM policies and rollover aliases.

Image: ghcr.io/svtechnmaa/logstash:{{ .Values.global.elasticsearch.version }} (8.9.1).

Tree level

+--- Chart.yaml : Chart information and dependencies (you can use as {{ .Chart }} variable on template files )
+--- README.md
+--- charts : packaged dependencies (common-1.4.3.tgz)
+--- templates : define your template files in this folder
|   +--- logstash.yml : Deployment
|   +--- logstash-service.yml : Service (syslog listeners)
|   +--- general-config-cm.yml : logstash.yml, jvm.options, startup.options
|   +--- pipelines-cm.yml : pipelines.yml - the list of active pipelines
|   +--- patterns-cm.yml : shared grok pattern sets
|   +--- dictionary-cm.yml : facility/severity/client-mode/timezone lookup tables
|   +--- flat-facility-configmap.yml : eventname -> facility lookup (offline pipeline)
|   +--- flat-severity-configmap.yml : eventname -> severity lookup (offline pipeline)
|   +--- flat-type-configmap.yml : eventname -> type lookup (offline pipeline)
|   +--- online-log-cm.yml : Junos live syslog pipeline
|   +--- offline-log-cm.yml : Junos offline (Rundeck upload) pipeline
|   +--- h3c-cm.yml : H3C Comware pipeline
|   +--- huawei-cm.yml : Huawei VRP pipeline
|   +--- fortinet-cm.yml : Fortinet FortiOS pipeline
+--- values.yaml : define {{ .Values }} variable to use in template files

What it deploys

TemplateObjectName
templates/logstash.ymlDeploymentlogstash (common.names.fullname)
templates/logstash-service.ymlServicelogstash (.Chart.Name)
templates/general-config-cm.ymlConfigMaplogstash-general-config
templates/pipelines-cm.ymlConfigMaplogstash-pipelines
templates/patterns-cm.ymlConfigMaplogstash-patterns
templates/dictionary-cm.ymlConfigMaplogstash-dictionary
templates/flat-*-configmap.ymlConfigMapflat-facility, flat-severity, flat-type
templates/online-log-cm.ymlConfigMaponline-log
templates/offline-log-cm.ymlConfigMapoffline-log
templates/h3c-cm.ymlConfigMaph3c
templates/huawei-cm.ymlConfigMaphuawei
templates/fortinet-cm.ymlConfigMapfortinet

The Deployment runs one init-chown-data initContainer (busybox) that creates /var/log/logstash on the host and chowns it to 1000:1000. Parse-failure files are written there through a hostPath mount, so they survive pod restarts and are readable from the node.

Pipelines

All five pipelines are declared in templates/pipelines-cm.yml and run with pipeline.ecs_compatibility: disabled.

Pipeline idListenerInput pluginTagTarget indexParse-failure sink
svtechlab5515 TCP + UDPtcp, udpjunos_logfirst index.name (e.g. junos-log)/var/log/logstash/login_failed_onlinelog_events-%{+YYYY-MM}
offline5555 TCPbeatsjunos_offlogoffline-log (hard-coded)/tmp/jun-offline-logstash_failed_parse_events-%{+YYYY-MM}
h3c5513 UDPudph3c_logentry with prefix h3c/var/log/logstash/h3c_failed_log-%{+YYYY-MM}
huawei5514 UDPudphuawei_logentry with prefix huawei/var/log/logstash/huawei_failed_log-%{+YYYY-MM}
fortinet5519 UDPudpfortinet_logentry with prefix fortinet/var/log/logstash/fortinet_failed_log-%{+YYYY-MM}

Every pipeline stamps received_at (ingest time) and received_from (sender, from [host]) before parsing.

Field naming

The Junos pipelines emit junos_*-prefixed field names; the vendor pipelines emit unprefixed names (hostname, severitycode, severityname, msg, time). Two couplings constrain any renaming:

  • kubernetes/juniper-syslog-api matches on junos_eventname, junos_procsname and junos_severitycode, and lists junos_procsname, junos_msg, junos_eventname, junos_hostname, @timestamp, junos_severityname, junos_facilityname. Renaming any of those breaks its alarm rules.
  • kubernetes/elasticsearch/templates/bootstrap-index.yaml maps only @timestamp, time and received_at as date in the shared index template. Any other timestamp field name falls through to the string_fields dynamic template and is mapped as text+keyword for the life of the index.

templates/online-log-cm.yml captures the device timestamp as time and its date filter has no target, so it also promotes @timestamp. templates/offline-log-cm.yml still uses time and its date filter targets time, so @timestamp there stays at ingest time.

Index selection

Three different mechanisms are in use — worth knowing before changing global.elasticsearch.index.name:

PipelineSelectionNotes
h3c, huawei, fortinetrange + hasPrefix "<vendor>"Site-specific names such as h3c-svtechlab-log still resolve
offlineliteral "offline-log"Ignores the values list entirely

The vendor templates call Helm fail if no entry carries their prefix, e.g.

logstash/h3c-cm.yml: global.elasticsearch.index.name has no entry with prefix "h3c" (got [junos-log offline-log])

Index names must match the ILM policy, index template and rollover alias created by the elasticsearch chart's bootstrap-es-index Job, which iterates over the same global.elasticsearch.index.name list.

Shared patterns and dictionaries

logstash-patterns is mounted at /etc/logstash/patterns/. Each ConfigMap key is one pattern file; pipelines select one with patterns_files_glob.

KeyUsed by
structured_logsvtechlab, h3c — PRIORITYCODE, TIMESTAMP_ISO8601, JUNHOSTNAME, PROCESSNAME, PROCESSID, EVENTNAME, SNMPINFO, MESSAGE, H3C_TIMESTAMP, H3C_MODULENAME
junos_off_*, junos_offlog_*, offlog_*, junos_fpcoffline
radius_logunused by the shipped pipelines

huawei and fortinet use only built-in grok patterns and inline named captures, so they need no entry here.

Dictionaries are projected together into /etc/logstash/dictionary/ from four ConfigMaps:

FileSource ConfigMapUsed by
facilitycode.yml, severitycode.yml, client_mode.yml, timezone.ymllogstash-dictionarysvtechlab, offline, h3c, huawei
flat_facility.ymlflat-facilityoffline
flat_severity.ymlflat-severityoffline
flat_type.ymlflat-typeoffline

fortinet uses no dictionary at all — FortiOS sends the severity name directly as level=, so deploying it needs no change to the shared dictionaries and cannot disturb the running Junos pipelines.

Prerequisites

  • Kubernetes 1.19+, Helm 3
  • The elasticsearch chart deployed in the same namespace. It provides:
    • the es-basic-auth Secret consumed by the Deployment's ES_USER / ES_PASSWORD
    • the <clusterName>-es-<node> Services used as Logstash output hosts
    • the ILM policies, index templates and rollover aliases created by bootstrap-es-index
  • ghcr-pull-secret in the namespace (both the Deployment and the initContainer pull from ghcr.io)
  • A writable /var/log/logstash on every node that can schedule the pod (hostPath)

Configuration

Chart values

ParameterDescriptionDefault
timezoneTZ for the container: wall-clock for Logstash's own logs, and the JVM default zone. Only a fallback for timestamp parsing — every date filter now sets its zone explicitlyAsia/Ho_Chi_Minh
device_timezoneZone the monitored devices report their local timestamps in, passed to the h3c, huawei and fortinet date filters. Decides the instant stored in time, not just its display. Falls back to timezone if unsetAsia/Ho_Chi_Minh
replicasIntended replica count — has no effect, the Deployment reads replicaCount (see logstash.yml:15)2
heapSize-Xms / -Xmx in jvm.options1001m
init.image.registry / .repository / .tag / .pullPolicyinitContainer imageghcr.io / svtechnmaa/busybox / 1.33 / IfNotPresent
service.typeService typeLoadBalancer
service.annotationsRendered through common.tplvalues.render if setunset
affinityPod affinity; the chart ships a requiredDuringScheduling anti-affinity on app=logstashsee values.yaml
nodeSelector, tolerations, resourcesStandard pod scheduling / limitsunset
securityContext.enabled, securityContext.fsGroupPod fsGroup{} (disabled)

Globals consumed

Supplied by the umbrella chart or the elasticsearch chart.

ParameterUsed for
global.elasticsearch.clusterNameBuilds output hosts <clusterName>-es-<node>
global.elasticsearch.nodes[].nameThe node list those hosts are built from — not defined in this chart's values.yaml
global.elasticsearch.versionLogstash image tag
global.elasticsearch.index.nameIndex selection (see above)
global.elasticsearch.adminUser.name / .passCredentials rendered into every pipeline's elasticsearch output
global.logstash.loadBalancerIPService loadBalancerIP
global.externalIPService externalIPs
global.imageRegistryOverrides ghcr.io for the Logstash image
global.timezoneOverrides .Values.timezone via common.timezone
global.ciForces one replica via common.replicas

How to use

  • Clone this repo:

    cd /opt
    git clone https://github.com/svtechnmaa/charts.git
    
  • Edit values.yaml at kubernetes/logstash:

    • timezone, heapSize, service.type
    • global.elasticsearch.clusterName and global.elasticsearch.index.name — the index list must contain one entry per vendor prefix (h3c, huawei, fortinet) or the render fails
    • global.logstash.loadBalancerIP
  • Start chart alone (requires global.elasticsearch.nodes to be supplied, see gotcha 2):

    helm install logstash kubernetes/logstash \
      --set-json 'global.elasticsearch.nodes=[{"name":"master"},{"name":"data"}]'
    
  • Verify:

    • Check pods and service

      kubectl get pods -l app.kubernetes.io/name=logstash
      kubectl get svc logstash
      
    • Check that all five pipelines started

      kubectl logs deploy/logstash | grep -i "Pipeline started"
      
    • Send a test event

      kubectl exec deploy/logstash -- bash -c 'echo "<190>Sep 25 09:20:34 2026 SW01 %%10SHELL/6/SHELL_LOGIN: test" > /dev/udp/127.0.0.1/5513'
      
    • Check for parse failures

      kubectl exec deploy/logstash -- ls -l /var/log/logstash/
      
  • Apply a pipeline change:

    The pipeline configs are mounted with subPath, which Kubernetes never updates in place, and the Deployment carries no ConfigMap checksum annotation. A helm upgrade that changes only a pipeline will not restart the pod:

    helm upgrade logstash kubernetes/logstash
    kubectl rollout restart deploy/logstash
    
  • Uninstallation:

    helm uninstall logstash
    

Adding a vendor pipeline

  1. Add any vendor-specific grok patterns to a new key in templates/patterns-cm.yml (skip if built-in patterns and inline named captures suffice).
  2. Create templates/<vendor>-cm.yml: copy the $newArray + index-selector + $deviceTZ preamble from an existing vendor template and change the prefix and the fail message.
  3. Give the pipeline a date filter with target => "time" and timezone => "{{ $deviceTZ }}" — device syslog carries no UTC offset, and the index template maps time as type: date, so a raw timestamp string gets the whole document rejected.
  4. Add a - pipeline.id: <vendor> entry to templates/pipelines-cm.yml.
  5. Add the volume and the subPath mount to templates/logstash.yml.
  6. Add the listener port to templates/logstash-service.yml.
  7. Add <vendor>-log to global.elasticsearch.index.name in both kubernetes/logstash/values.yaml and kubernetes/elasticsearch/values.yaml.
  8. Re-run the bootstrap-es-index Job so the ILM policy, index template and rollover alias exist before the first event arrives.

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.0.6 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