This document provides comprehensive deployment configurations for Logstash as both standalone collector and Filebeat log shipper, including Docker containerization, Kubernetes cluster deployment templates, and multiline log parsing implementations.
This article was published 744 days ago, some content may be outdated. If you have any questions, please leave a comment.
apiVersion:v1kind:ConfigMapmetadata:name:filebeat-configdata:filebeat.yml:|filebeat.inputs:-type:logenabled:truepaths:-/logs/*_info.logscan_frequency:1s# set scan frequency to 1 secondharvester_buffer_size:32768# increase harvester buffer sizebackoff_factor:2ignore_older:24h# ignore files older than 24 hoursclose_inactive:5m# close harvester inactive for 5 minutesclean_inactive:72h# clean inactive harvester after 72 hoursclose_removed:true# close harvester when file is removedclean_removed:true# clean removed harvesterclose_eof:true# close harvester when file reaches EOFmultiline.pattern:'^[0-9]{4}'# match multiline logsmultiline.negate:truemultiline.match:aftervar.convert_timezone:true# convert timezoneencoding:UTF-8# set encodingfields:wisentIp:0.0.0.0# add custom fieldlog_type:info_log-type:logenabled:truepaths:-/logs/*_error.logscan_frequency:1s# set scan frequency to 1 secondharvester_buffer_size:32768# increase harvester buffer sizebackoff_factor:2ignore_older:24h# ignore files older than 24 hoursclose_inactive:5m# close harvester inactive for 5 minutesclean_inactive:72h# clean inactive harvester after 72 hoursclose_removed:true# close harvester when file is removedclean_removed:true# clean removed harvesterclose_eof:true# close harvester when file reaches EOFmultiline.pattern:'^[0-9]{4}'# match multiline logsmultiline.negate:truemultiline.match:aftervar.convert_timezone:true# convert timezoneencoding:UTF-8# set encodingfields:wisentIp:0.0.0.0# add custom fieldlog_type:error_logqueue.mem:events:4096# memory queue sizeflush.min_events:2048# minimum flush eventsflush.timeout:1s# flush timeout#queue.disk:# max_size: 1024mb # maximum disk usage# segment_size: 10mb # size of each segment# max_retries: 3 # maximum retrieslogging.level:debugfilebeat.shutdown_timeout:30s# ensure enough time to process current events when shutting down Filebeatthrottle:5s# set the time Filebeat waits before being throttledlogging.level:info# set logging level to info for detailed run informationlogging.to_files:truelogging.files:path:/usr/share/filebeat/logsname:filebeatkeepfiles:7permissions:0644output.logstash:hosts:["logstash-svc.default.svc.cluster.local:5044"]---kind:DeploymentapiVersion:apps/v1metadata:name:filebeatlabels:app:filebeatspec:replicas:1selector:matchLabels:app:filebeattemplate:metadata:labels:app:filebeatannotations:appName:filebeatappType:javaspec:containers:-name:filebeat-loggingimage:registry.cn-beijing.aliyuncs.com/kaikai136/filebeat:8.12.0volumeMounts:-name:filebeat-configmountPath:/usr/share/filebeat/filebeat.ymlsubPath:filebeat.yml-name:myhostpathmountPath:/logsvolumes:-name:filebeat-configconfigMap:name:filebeat-configitems:-key:filebeat.ymlpath:filebeat.yml-name:myhostpathhostPath:path:/opt/kaikai/file-logstash/filebeat_logtype:DirectoryOrCreateimagePullSecrets:-name:my-harbor