Update 3 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 45s

This commit is contained in:
Your Name
2025-09-20 11:34:01 +12:00
parent cb4bf8451f
commit d32042e42d
3 changed files with 17 additions and 2 deletions

View File

@@ -31,6 +31,9 @@ WORKER_THREADS=${WORKER_THREADS:-1}
QUEUE_SIZE=${QUEUE_SIZE:-4096}
MAX_BACKOFF=${MAX_BACKOFF:-60s}
# Get actual hostname from the host system
ACTUAL_HOSTNAME=${HOSTNAME:-$(hostname 2>/dev/null || echo "unknown")}
# Generate filebeat.yml configuration with variable substitution
(
cat << 'TEMPLATE_EOF'
@@ -78,6 +81,15 @@ processors:
- add_host_metadata:
when.not.contains:
tags: forwarded
# Override hostname with actual host's hostname
- add_fields:
target: agent
fields:
hostname: __ACTUAL_HOSTNAME__
- add_fields:
target: host
fields:
name: __ACTUAL_HOSTNAME__
# ======================== Output Configuration ===============================
output.logstash:
@@ -133,7 +145,8 @@ TEMPLATE_EOF
-e "s|__BULK_MAX_SIZE__|${BULK_MAX_SIZE}|g" \
-e "s|__WORKER_THREADS__|${WORKER_THREADS}|g" \
-e "s|__QUEUE_SIZE__|${QUEUE_SIZE}|g" \
-e "s|__MAX_BACKOFF__|${MAX_BACKOFF}|g" > "$CONFIG_DIR/filebeat.yml"
-e "s|__MAX_BACKOFF__|${MAX_BACKOFF}|g" \
-e "s|__ACTUAL_HOSTNAME__|${ACTUAL_HOSTNAME}|g" > "$CONFIG_DIR/filebeat.yml"
echo "Filebeat configuration generated at: $CONFIG_DIR/filebeat.yml"
echo "Configuration:"