/devops-skills:fluentbit-generatorfrom devops-skills
Generates production-ready Fluent Bit configurations with best practices for log collection pipelines, parsers, and output destinations.
Ships in devops-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
This skill provides a comprehensive workflow for generating production-ready Fluent Bit configurations with best practices built-in. Generate complete pipelines or individual sections (SERVICE, INPUT, FILTER, OUTPUT, PARSER) with proper syntax, optimal performance settings, and automatic validation.
Fluent Bit is a fast and lightweight telemetry agent for logs, metrics, and traces. It's part of the CNCF (Cloud Native Computing Foundation) and is commonly used in Kubernetes environments for log aggregation, forwarding, and processing.
Invoke this skill when:
Follow this workflow when generating Fluent Bit configurations. Adapt based on user needs:
Gather information about the logging infrastructure needs:
Use case identification:
Input sources:
Processing requirements:
Output destinations:
Performance and reliability:
Use AskUserQuestion if information is missing or unclear.
Step 1: Always verify script capabilities first:
# REQUIRED: Run --help to check if your use case is supported
python3 scripts/generate_config.py --help
Step 2: For supported use cases, prefer using generate_config.py for consistency and tested templates:
# Generate configuration for a supported use case
python3 scripts/generate_config.py --use-case kubernetes-elasticsearch --output fluent-bit.conf
python3 scripts/generate_config.py --use-case kubernetes-opentelemetry --cluster-name my-cluster --output fluent-bit.conf
Supported use cases: kubernetes-elasticsearch, kubernetes-loki, kubernetes-cloudwatch, kubernetes-opentelemetry, application-multiline, syslog-forward, file-tail-s3, http-kafka, multi-destination, prometheus-metrics, lua-filtering, stream-processor, custom.
Step 3: Use manual generation (Stages 3-8) when:
--help)Document your decision: When choosing manual generation, explicitly state why the script was not suitable (e.g., "Manual generation chosen because grep filter for log levels is not supported by the script").
REQUIRED before writing any manual configuration:
Identify the closest matching example from the examples/ directory:
examples/kubernetes-elasticsearch.confexamples/kubernetes-loki.confexamples/kubernetes-opentelemetry.confexamples/application-multiline.confexamples/syslog-forward.confexamples/file-tail-s3.confexamples/http-input-kafka.confexamples/multi-destination.confexamples/prometheus-metrics.confexamples/lua-filtering.confexamples/stream-processor.confexamples/full-production.confRead the example file using the Read tool to understand:
Read examples/parsers.conf for parser definitions - reuse existing parsers rather than recreating them.
Use examples as templates - copy relevant sections and customize for the user's requirements.
If the configuration requires specific plugins or custom output destinations:
Identify plugins needing documentation:
Try context7 MCP first (preferred):
Use mcp__context7__resolve-library-id with "fluent-bit" or "fluent/fluent-bit"
Then use mcp__context7__get-library-docs with:
- context7CompatibleLibraryID: /fluent/fluent-bit-docs (or /fluent/fluent-bit)
- topic: The plugin name and configuration (e.g., "elasticsearch output configuration")
- page: 1 (fetch additional pages if needed)
Fallback to WebSearch if context7 fails:
Search query patterns:
"fluent-bit" "<plugin-type>" "<plugin-name>" "configuration" "parameters" site:docs.fluentbit.io
Examples:
"fluent-bit" "output" "elasticsearch" "configuration" site:docs.fluentbit.io
"fluent-bit" "filter" "kubernetes" "configuration" site:docs.fluentbit.io
"fluent-bit" "parser" "multiline" "configuration" site:docs.fluentbit.io
Extract key information:
ALWAYS start with the SERVICE section - this defines global behavior:
[SERVICE]
# Flush interval in seconds - how often to flush data to outputs
# Lower values = lower latency, higher CPU usage
# Recommended: 1-5 seconds for most use cases
Flush 1
# Daemon mode - run as background process (Off in containers)
Daemon Off
# Log level: off, error, warn, info, debug, trace
# Recommended: info for production, debug for troubleshooting
Log_Level info
# Optional: Write Fluent Bit's own logs to file
# Log_File /var/log/fluent-bit.log
# Parser configuration file (if using custom parsers)
Parsers_File parsers.conf
# Enable built-in HTTP server for metrics and health checks
# Recommended for Kubernetes liveness/readiness probes
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port 2020
# Enable storage metrics endpoint
storage.metrics on
# Number of worker threads (0 = auto-detect CPU cores)
# Increase for high-volume environments
# workers 0
Key SERVICE parameters:
info in production, debug for troubleshootingCreate INPUT sections for data sources. Common patterns:
[INPUT]
Name tail
Tag kube.*
Path /var/log/containers/*.log
# Exclude Fluent Bit's own logs to prevent loops
Exclude_Path /var/log/containers/*fluent-bit*.log
Parser docker
DB /var/log/flb_kube.db
Mem_Buf_Limit 50MB
Skip_Long_Lines On
Refresh_Interval 10
Read_from_Head Off
Key INPUT patterns:
tail plugin (most common):
Path: File path or wildcard patternTag: Routing tag for filters/outputsParser: Pre-parser for log format (docker, cri, json)DB: Position database for crash recoveryMem_Buf_Limit: Per-input memory limit (prevents OOM)Skip_Long_Lines: Skip lines > 32KB (prevents hang)Read_from_Head: Start from beginning (false for new logs only)systemd plugin:
[INPUT]
Name systemd
Tag host.*
Systemd_Filter _SYSTEMD_UNIT=kubelet.service
Read_From_Tail On
[INPUT]
Name http
Tag app.logs
Listen 0.0.0.0
Port 9880
Buffer_Size 32KB
[INPUT]
Name forward
Tag forward.*
Listen 0.0.0.0
Port 24224
Best practices for INPUT:
Mem_Buf_Limit to prevent memory issuesDB for tail inputs to track file positionsTag patterns for routingExclude_Path to prevent log loopsSkip_Long_Lines for robustnessCreate FILTER sections for log processing and enrichment:
[FILTER]
Name kubernetes
Match kube.*
Kube_URL https://kubernetes.default.svc:443
Kube_CA_File /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
Kube_Token_File /var/run/secrets/kubernetes.io/serviceaccount/token
Kube_Tag_Prefix kube.var.log.containers.
Merge_Log On
Keep_Log Off
K8S-Logging.Parser On
K8S-Logging.Exclude On
Labels On
Annotations Off
Buffer_Size 0
Key FILTER patterns:
kubernetes filter (metadata enrichment):
Merge_Log: Parse JSON logs into structured fieldsKeep_Log: Keep original log field (Off saves space)K8S-Logging.Parser: Honor pod parser annotationsK8S-Logging.Exclude: Honor pod exclude annotationsLabels: Include pod labels in outputAnnotations: Include pod annotations (optional, increases size)parser filter (structured parsing):
[FILTER]
Name parser
Match *
Key_Name log
Parser json
Reserve_Data On
Preserve_Key Off
[FILTER]
Name grep
Match *
# Include only error logs
Regex level (error|fatal|critical)
# Exclude health check logs
Exclude path /health
[FILTER]
Name modify
Match *
Add cluster_name production
Add environment prod
Remove _p
[FILTER]
Name nest
Match *
Operation lift
Nested_under kubernetes
Add_prefix k8s_
[FILTER]
Name multiline
Match *
multiline.key_content log
multiline.parser java, python, go
[FILTER]
Name throttle
Match *
Rate 1000
Window 5
Interval 1m
[FILTER]
Name lua
Match *
script /fluent-bit/scripts/filter.lua
call process_record
Example Lua script (/fluent-bit/scripts/filter.lua):
function process_record(tag, timestamp, record)
-- Add custom field
record["custom_field"] = "custom_value"
-- Transform existing field
if record["level"] then
record["severity"] = string.upper(record["level"])
end
-- Filter out specific records (return -1 to drop)
if record["message"] and string.match(record["message"], "DEBUG") then
return -1, timestamp, record
end
-- Return modified record
return 1, timestamp, record
end
Best practices for FILTER:
Kubernetes filter in K8s environments for enrichmentgrep to reduce data volume early in pipelineCreate OUTPUT sections for destination systems:
[OUTPUT]
Name es
Match *
Host elasticsearch.default.svc
Port 9200
# Index pattern with date
Logstash_Format On
Logstash_Prefix fluent-bit
Retry_Limit 3
# Buffer configuration
storage.total_limit_size 5M
# TLS configuration
tls On
tls.verify Off
# Authentication
HTTP_User ${ES_USER}
HTTP_Passwd ${ES_PASSWORD}
# Performance tuning
Buffer_Size False
Type _doc
[OUTPUT]
Name loki
Match *
Host loki.default.svc
Port 3100
# Label extraction from metadata
labels job=fluent-bit, namespace=$kubernetes['namespace_name'], pod=$kubernetes['pod_name'], container=$kubernetes['container_name']
label_keys $stream
# Remove Kubernetes metadata to reduce payload size
remove_keys kubernetes,stream
# Auto Kubernetes labels
auto_kubernetes_labels on
# Line format
line_format json
# Retry configuration
Retry_Limit 3
[OUTPUT]
Name s3
Match *
bucket my-logs-bucket
region us-east-1
total_file_size 100M
upload_timeout 10m
use_put_object Off
# Compression
compression gzip
# Path structure with time formatting
s3_key_format /fluent-bit-logs/%Y/%m/%d/$TAG[0]/%H-%M-%S-$UUID.gz
# IAM role authentication (recommended)
# Or use AWS credentials
# AWS credentials loaded from environment or IAM role
Retry_Limit 3
[OUTPUT]
Name kafka
Match *
Brokers kafka-broker-1:9092,kafka-broker-2:9092
Topics logs
# Message format
Format json
# Timestamp key
Timestamp_Key @timestamp
# Retry configuration
Retry_Limit 3
# Queue configuration
rdkafka.queue.buffering.max.messages 100000
rdkafka.request.required.acks 1
[OUTPUT]
Name cloudwatch_logs
Match *
region us-east-1
log_group_name /aws/fluent-bit/logs
log_stream_prefix from-fluent-bit-
auto_create_group On
Retry_Limit 3
[OUTPUT]
Name opentelemetry
Match *
Host opentelemetry-collector.observability.svc
Port 4318
# Use HTTP protocol for OTLP
logs_uri /v1/logs
# Add resource attributes
add_label cluster my-cluster
add_label environment production
# TLS configuration
tls On
tls.verify Off
# Retry configuration
Retry_Limit 3
[OUTPUT]
Name prometheus_remote_write
Match *
Host prometheus.monitoring.svc
Port 9090
Uri /api/v1/write
# Add labels to all metrics
add_label cluster my-cluster
add_label environment production
# TLS configuration
tls On
tls.verify Off
# Retry configuration
Retry_Limit 3
# Compression
compression snappy
[OUTPUT]
Name http
Match *
Host logs.example.com
Port 443
URI /api/logs
Format json
# TLS
tls On
tls.verify On
# Authentication
Header Authorization Bearer ${API_TOKEN}
# Compression
Compress gzip
# Retry configuration
Retry_Limit 3
[OUTPUT]
Name stdout
Match *
Format json_lines
Key OUTPUT patterns:
Common parameters:
Name: Output plugin nameMatch: Tag pattern to match (supports wildcards)Retry_Limit: Number of retries (0 = infinite)storage.total_limit_size: Disk buffer limitBuffer and retry configuration:
# Memory buffering (default)
storage.type memory
# Filesystem buffering (for high reliability)
storage.type filesystem
storage.path /var/log/fluent-bit-buffer/
storage.total_limit_size 10G
# Retry configuration
Retry_Limit 5
TLS configuration:
tls On
tls.verify On
tls.ca_file /path/to/ca.crt
tls.crt_file /path/to/client.crt
tls.key_file /path/to/client.key
Best practices for OUTPUT:
Retry_Limit (3-5 for most cases)${ENV_VAR}storage.total_limit_size to prevent disk exhaustionIMPORTANT: Always check examples/parsers.conf first before creating custom parsers. The examples directory contains production-ready parser definitions for common use cases.
Step 1: Read the existing parsers file:
# Read the examples/parsers.conf file to see available parsers
Read examples/parsers.conf
Step 2: Reuse existing parsers when possible. The examples/parsers.conf includes:
docker - Docker JSON log formatjson - Generic JSON logscri - CRI container runtime formatsyslog-rfc3164 - Syslog RFC 3164syslog-rfc5424 - Syslog RFC 5424nginx - Nginx access logsapache - Apache access logsapache_error - Apache error logsmongodb - MongoDB logsmultiline-java - Java stack tracesmultiline-python - Python tracebacksmultiline-go - Go panic tracesmultiline-ruby - Ruby exceptionsStep 3: Only create custom parsers when the existing ones don't match your log format.
Example custom parser definition (only if needed):
# parsers.conf - Add custom parsers alongside existing ones
[PARSER]
Name custom-app
Format regex
Regex ^(?<timestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) \[(?<level>\w+)\] (?<message>.*)$
Time_Key timestamp
Time_Format %Y-%m-%d %H:%M:%S
Parser types:
Best practices for PARSER:
examples/parsers.conf - copy and extend rather than recreating from scratchTime_Key and Time_Format for proper timestampsMULTILINE_PARSER for stack tracesA production-ready Fluent Bit configuration follows this structure:
fluent-bit.conf # Main configuration file
parsers.conf # Custom parser definitions (optional)
Before writing a new configuration, consult the examples/ directory for production-ready templates:
examples/ files that match your use caseexamples/parsers.conf for parser definitionsExample complete configuration (Kubernetes to Elasticsearch):
# fluent-bit.conf
[SERVICE]
Flush 1
Daemon Off
Log_Level info
Parsers_File parsers.conf
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port 2020
storage.metrics on
[INPUT]
Name tail
Tag kube.*
Path /var/log/containers/*.log
Exclude_Path /var/log/containers/*fluent-bit*.log
Parser docker
DB /var/log/flb_kube.db
Mem_Buf_Limit 50MB
Skip_Long_Lines On
Refresh_Interval 10
[FILTER]
Name kubernetes
Match kube.*
Kube_URL https://kubernetes.default.svc:443
Kube_CA_File /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
Kube_Token_File /var/run/secrets/kubernetes.io/serviceaccount/token
Kube_Tag_Prefix kube.var.log.containers.
Merge_Log On
Keep_Log Off
K8S-Logging.Parser On
K8S-Logging.Exclude On
Labels On
Annotations Off
[FILTER]
Name modify
Match *
Add cluster_name my-cluster
Add environment production
[FILTER]
Name nest
Match *
Operation lift
Nested_under kubernetes
[OUTPUT]
Name es
Match *
Host elasticsearch.logging.svc
Port 9200
Logstash_Format On
Logstash_Prefix k8s
Retry_Limit 3
storage.total_limit_size 5M
tls On
tls.verify Off
Apply these best practices to all generated configurations:
Buffer management:
Mem_Buf_Limit on inputs (default 32MB can cause OOM)storage.type filesystem for high-reliability scenariosstorage.total_limit_size to prevent disk exhaustionFlush and batching:
Flush 1-5: Balance between latency and efficiencyWorker threads:
Compression:
Retry logic:
Retry_Limit 3-5 on all outputsHealth checks:
HTTP_Server for liveness/readiness probesDatabase files:
DB parameter for tail inputsTLS/SSL:
tls On)tls.verify On for production deploymentstls.verify Off ONLY in these scenarios:
tls.verify Off, always add a comment explaining the reason:
tls On
tls.verify Off # Internal cluster with self-signed certs
Credentials:
${VAR_NAME}RBAC (Kubernetes):
Memory:
Mem_Buf_Limit 50MBCPU:
Disk:
storage.metrics onStructured logging:
Log levels:
Avoid log loops:
Exclude_Path patternALWAYS validate the generated configuration using the devops-skills:fluentbit-validator skill:
Invoke the devops-skills:fluentbit-validator skill to validate the config:
1. Syntax validation (section format, key-value pairs)
2. Required field checks
3. Plugin parameter validation
4. Tag consistency checks
5. Parser reference validation
6. Security checks (plaintext passwords)
7. Best practice recommendations
8. Dry-run testing (if fluent-bit binary available)
Follow the devops-skills:fluentbit-validator workflow to identify and fix any issues.
Validation checklist:
If validation fails, fix issues and re-validate until all checks pass.
Configuration syntax errors:
[SECTION] formatMemory issues (OOM):
Mem_Buf_Limit on all tail inputsMissing logs:
DB file for position trackingExclude_Path patternsParser failures:
Kubernetes metadata missing:
Output connection failures:
High CPU usage:
Disk full (buffering):
storage.total_limit_sizeWhen generating configurations:
After generating any Fluent Bit configuration, automatically invoke the devops-skills:fluentbit-validator skill to ensure quality:
Steps:
1. Generate the Fluent Bit configuration
2. Invoke devops-skills:fluentbit-validator skill with the config file
3. Review validation results
4. Fix any issues identified
5. Re-validate until all checks pass
6. Provide summary of generated config and validation status
This ensures all generated configurations follow best practices and are production-ready.
generate_config.py
kubernetes-elasticsearch - K8s logs to Elasticsearchkubernetes-loki - K8s logs to Lokikubernetes-cloudwatch - K8s logs to CloudWatchkubernetes-opentelemetry - K8s logs to OpenTelemetry (NEW)application-multiline - App logs with multiline parsingsyslog-forward - Syslog forwardingfile-tail-s3 - File tailing to S3http-kafka - HTTP webhook to Kafkamulti-destination - Multiple output destinationsprometheus-metrics - Prometheus metrics collection (NEW)lua-filtering - Lua script filtering (NEW)stream-processor - Stream processor for analytics (NEW)custom - Minimal custom templatepython3 scripts/generate_config.py --use-case kubernetes-elasticsearch --output fluent-bit.confContains production-ready example configurations:
kubernetes-elasticsearch.conf - K8s logs to Elasticsearch with metadata enrichmentkubernetes-loki.conf - K8s logs to Loki with labelskubernetes-opentelemetry.conf - K8s logs to OpenTelemetry Collector (OTLP/HTTP)application-multiline.conf - App logs with stack trace parsingsyslog-forward.conf - Syslog collection and forwardingfile-tail-s3.conf - File tailing to S3 with compressionhttp-input-kafka.conf - HTTP webhook to Kafkamulti-destination.conf - Logs to multiple outputs (Elasticsearch + S3)prometheus-metrics.conf - Metrics collection and Prometheus remote_writelua-filtering.conf - Custom Lua script filtering and transformationstream-processor.conf - SQL-like stream processing for analyticsparsers.conf - Custom parser examples (JSON, regex, multiline)full-production.conf - Complete production setupcloudwatch.conf - AWS CloudWatch integrationBased on comprehensive research from:
examples/application-multiline.conf (opens in a new tab)examples/cloudwatch.conf (opens in a new tab)examples/file-tail-s3.conf (opens in a new tab)examples/full-production.conf (opens in a new tab)examples/http-input-kafka.conf (opens in a new tab)examples/kubernetes-elasticsearch.conf (opens in a new tab)examples/kubernetes-loki.conf (opens in a new tab)examples/kubernetes-opentelemetry.conf (opens in a new tab)examples/lua-filtering.conf (opens in a new tab)examples/multi-destination.conf (opens in a new tab)examples/parsers.conf (opens in a new tab)examples/prometheus-metrics.conf (opens in a new tab)examples/stream-processor.conf (opens in a new tab)examples/syslog-forward.conf (opens in a new tab)output/k8s-errors-elasticsearch.conf (opens in a new tab)output/parsers.conf (opens in a new tab)scripts/generate_config.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (gitjfmd/ansible-skills) — no native marketplace selected
npx claudepluginhub p/gitjfmd-devops-skills-devops-skills-plugin31 skills in this plugin
/ansible-generatorComprehensive toolkit for generating best practice Ansible playbooks, roles, tasks, and inventory files./ansible-validatorComprehensive toolkit for validating, linting, testing, and automating Ansible playbooks, roles, and collections. Use this skill when working with Ansible files (.yml, .yaml playbooks, roles, inventories), validating automation code, debugging playbook execution, performing dry-run testing with check mode, or working with custom modules and collections./azure-pipelines-generatorComprehensive toolkit for generating best practice Azure DevOps Pipelines following current standards and conventions. Use this skill when creating new Azure Pipelines, implementing CI/CD workflows, or building deployment pipelines.Other plugins' skills for the same job