Update 3 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 45s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 45s
This commit is contained in:
@@ -34,9 +34,10 @@ bash ./stop.sh || true
|
||||
# Remove old container
|
||||
_remove_container "$CONTAINER_NAME" || true
|
||||
|
||||
# Generate Filebeat configuration
|
||||
# Generate Filebeat configuration (with actual hostname)
|
||||
echo "Generating Filebeat configuration..."
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
export HOSTNAME=$(hostname)
|
||||
bash "$SCRIPT_DIR/scripts/generate-config.sh" || _die "Failed to generate configuration"
|
||||
|
||||
# Create volumes using common function
|
||||
|
@@ -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:"
|
||||
|
@@ -19,6 +19,7 @@ DOCKER_RUN_CMD="docker run -d \
|
||||
-e LOGSERVER_HOST=${LOGSERVER_HOST} \
|
||||
-e LOGSERVER_PORT=${LOGSERVER_PORT} \
|
||||
-e API_KEY=${API_KEY} \
|
||||
-e HOSTNAME=$(hostname) \
|
||||
$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG \
|
||||
filebeat -e -strict.perms=false \
|
||||
-c /usr/share/filebeat/config/filebeat.yml"
|
||||
|
Reference in New Issue
Block a user