test
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/cron/woodpecker Pipeline was successful

This commit is contained in:
dvirlabs 2026-04-20 13:23:35 +03:00
parent b3e96d343f
commit 3282870e8f
3 changed files with 47 additions and 10 deletions

View File

@ -1,11 +1,32 @@
#!/bin/bash
set -e
echo "Applying rsyslog config from git repo..."
# Load configuration
CONFIG_FILE="${CONFIG_FILE:-config.local.env}"
if [ ! -f "$CONFIG_FILE" ]; then
CONFIG_FILE="config.env"
fi
cp rsyslog.conf /etc/rsyslog.conf
mkdir -p /etc/rsyslog.d
cp rsyslog.d/*.conf /etc/rsyslog.d/
if [ ! -f "$CONFIG_FILE" ]; then
echo "ERROR: Configuration file not found. Please create config.local.env or config.env"
exit 1
fi
# shellcheck disable=SC1090
source "$CONFIG_FILE"
echo "Applying rsyslog config from git repo..."
echo " Main config: $GIT_RSYSLOG_MAIN_CONFIG$RSYSLOG_MAIN_CONFIG"
echo " Config dir: $GIT_RSYSLOG_CONFIG_DIR$RSYSLOG_CONFIG_DIR"
if [ ! -f "$GIT_RSYSLOG_MAIN_CONFIG" ]; then
echo "ERROR: Source file not found: $GIT_RSYSLOG_MAIN_CONFIG"
exit 1
fi
cp "$GIT_RSYSLOG_MAIN_CONFIG" "$RSYSLOG_MAIN_CONFIG"
mkdir -p "$RSYSLOG_CONFIG_DIR"
cp "$GIT_RSYSLOG_CONFIG_DIR"/*.conf "$RSYSLOG_CONFIG_DIR/"
echo "Validating config..."
rsyslogd -N1

View File

@ -1,21 +1,37 @@
#!/bin/bash
set -e
# Load configuration
CONFIG_FILE="${CONFIG_FILE:-config.local.env}"
if [ ! -f "$CONFIG_FILE" ]; then
CONFIG_FILE="config.env"
fi
if [ ! -f "$CONFIG_FILE" ]; then
echo "ERROR: Configuration file not found. Please create config.local.env or config.env"
exit 1
fi
# shellcheck disable=SC1090
source "$CONFIG_FILE"
echo "Checking drift between git repo and live server..."
echo " Comparing: $GIT_RSYSLOG_MAIN_CONFIG$RSYSLOG_MAIN_CONFIG"
echo " Comparing: $GIT_RSYSLOG_CONFIG_DIR$RSYSLOG_CONFIG_DIR"
DIFF_FOUND=0
echo
echo "Comparing /etc/rsyslog.conf"
if ! diff -u rsyslog.conf /etc/rsyslog.conf; then
echo "Comparing $RSYSLOG_MAIN_CONFIG"
if ! diff -u "$GIT_RSYSLOG_MAIN_CONFIG" "$RSYSLOG_MAIN_CONFIG"; then
DIFF_FOUND=1
fi
echo
echo "Comparing rsyslog.d configs"
for file in rsyslog.d/*.conf; do
echo "Comparing $RSYSLOG_CONFIG_DIR configs"
for file in "$GIT_RSYSLOG_CONFIG_DIR"/*.conf; do
base=$(basename "$file")
target="/etc/rsyslog.d/$base"
target="$RSYSLOG_CONFIG_DIR/$base"
if [ ! -f "$target" ]; then
echo "Missing on server: $target"

View File

@ -5,7 +5,7 @@
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf
# TEST AMIT
# TEST Eliran
#################
#### MODULES ####
#################