config: Add 20 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 10s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 10s
This commit is contained in:
48
graylog-client/install.sh
Executable file
48
graylog-client/install.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
_check_required_env_vars "CONTAINER_NAME" "GRAYLOG_HOST" "GRAYLOG_PORT"
|
||||
|
||||
# Check Docker
|
||||
_check_docker_installed || _die "Docker test failed"
|
||||
|
||||
# Test connectivity to Graylog server
|
||||
echo "Testing connectivity to Graylog at ${GRAYLOG_HOST}:${GRAYLOG_PORT}..."
|
||||
if command -v nc >/dev/null 2>&1; then
|
||||
nc -zv -w3 "$GRAYLOG_HOST" "$GRAYLOG_PORT" 2>/dev/null || echo "WARNING: Cannot connect to Graylog server. Will retry when container starts."
|
||||
else
|
||||
echo "Note: 'nc' not installed, skipping connectivity test"
|
||||
fi
|
||||
|
||||
# Stop any existing container
|
||||
bash ./stop.sh 2>/dev/null || true
|
||||
|
||||
# Generate configuration
|
||||
echo "Generating configuration..."
|
||||
HOSTNAME=$(hostname)
|
||||
export HOSTNAME CONFIG_PATH GRAYLOG_HOST GRAYLOG_PORT GRAYLOG_PROTOCOL
|
||||
bash "$SCRIPT_DIR/scripts/generate-config.sh" || _die "Failed to generate configuration"
|
||||
|
||||
# Start the client
|
||||
echo "Starting Graylog Client..."
|
||||
cd "$SCRIPT_DIR" || _die "Failed to change to script directory"
|
||||
docker compose up -d || _die "Failed to start"
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Graylog Client Installed!"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "Shipping logs to: ${GRAYLOG_HOST}:${GRAYLOG_PORT} (${GRAYLOG_PROTOCOL:-udp})"
|
||||
echo "Hostname label: $(hostname)"
|
||||
echo ""
|
||||
echo "Collecting:"
|
||||
echo " - All Docker container logs"
|
||||
echo " - System logs (/var/log/syslog, /var/log/messages)"
|
||||
echo " - Auth logs (/var/log/auth.log, /var/log/secure)"
|
||||
echo ""
|
||||
echo "IMPORTANT: Create a GELF input in Graylog:"
|
||||
echo " System -> Inputs -> Select 'GELF UDP' or 'GELF TCP'"
|
||||
echo " Set port to ${GRAYLOG_PORT}"
|
||||
echo "========================================="
|
||||
Reference in New Issue
Block a user