Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress symbol errors, auto-populate default conf version #22

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion root/defaults/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Default syslog-ng.conf file which collects all local logs into a
# single file called /var/log/messages tailored to container usage.

@version: 4.1
@version: |VERSION|
@include "scl.conf"

source s_local {
Expand Down
6 changes: 4 additions & 2 deletions root/etc/s6-overlay/s6-rc.d/init-syslog-ng-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
# shellcheck shell=bash

#Copy defaults
SYSLOG_VERSION=$(syslog-ng --version 2>/dev/null | grep "Config version" | awk -F ':' '{print $2}' | tr -d '[:space:]')

if [[ ! -f "/config/syslog-ng.conf" ]]; then
cp -a /defaults/syslog-ng.conf /config/syslog-ng.conf
sed -i "s/|VERSION|/${SYSLOG_VERSION}/" /config/syslog-ng.conf
fi

CONF_VERSION=$(grep -oP "@version: \K(\d+\.\d+)" "/config/syslog-ng.conf")
SYSLOG_VERSION=$(syslog-ng --version | grep "Config version" | awk -F ':' '{print $2}' | tr -d '[:space:]')

if [[ -f "/config/syslog-ng.conf" ]] && (( $(bc -l <<< "${CONF_VERSION} < ${SYSLOG_VERSION}") )); then
cat <<-EOF
Expand All @@ -21,7 +23,7 @@ cat <<-EOF
* To upgrade the configuration, please review any *
* warnings about incompatible changes in the log. *
* *
* Once completed change the @version header at the *
* Once completed change the @version header at the *
* top of the configuration file to "${SYSLOG_VERSION}" *
* *
* *
Expand Down