rsyslog: add
Some checks are pending
continuous-integration/laminar-eldarion Build failed with exit code 123 after 3 seconds
Some checks are pending
continuous-integration/laminar-eldarion Build failed with exit code 123 after 3 seconds
This commit is contained in:
parent
3a859cfc6f
commit
cadb3272e9
3 changed files with 88 additions and 0 deletions
32
src/configs/rsyslog-client.conf
Normal file
32
src/configs/rsyslog-client.conf
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#################
|
||||||
|
#### MODULES ####
|
||||||
|
#################
|
||||||
|
|
||||||
|
module(load="imuxsock") # provides support for local system logging
|
||||||
|
module(load="imklog") # provides kernel logging support
|
||||||
|
#module(load="immark") # provides --MARK-- message capability
|
||||||
|
|
||||||
|
###########################
|
||||||
|
#### GLOBAL DIRECTIVES ####
|
||||||
|
###########################
|
||||||
|
|
||||||
|
# Where to place spool and state files
|
||||||
|
$WorkDirectory /var/spool/rsyslog
|
||||||
|
|
||||||
|
$IncludeConfig /etc/rsyslog.d/*.conf
|
||||||
|
|
||||||
|
|
||||||
|
###############
|
||||||
|
#### RULES ####
|
||||||
|
###############
|
||||||
|
$DefaultNetstreamDriverCAFile /etc/ssl/isrg-root-x1-cross-signed.pem
|
||||||
|
$DefaultNetstreamDriver gtls
|
||||||
|
$ActionSendStreamDriverMode 1 # Require TLS
|
||||||
|
$ActionSendStreamDriverAuthMode anon
|
||||||
|
*.* @@(o)logs.mooncarrot.space:514 # Forward everything to our rsyslog server
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Emergencies are sent to everybody logged in.
|
||||||
|
#
|
||||||
|
*.emerg :omusrmsg:*
|
43
src/steps-config/100-logging.sh
Executable file
43
src/steps-config/100-logging.sh
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
logging_mode="$(ask_multichoice "Logging mode" "rsyslog-client" "ramlog" "none")";
|
||||||
|
|
||||||
|
do_ramlog() {
|
||||||
|
if ! grep -q '# ---SBRL-RAMLOG---' /etc/fstab; then
|
||||||
|
echo "# ---SBRL-RAMLOG---" >>/etc/fstab;
|
||||||
|
echo "tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid,noexec,mode=1777" >>/etc/fstab;
|
||||||
|
fi
|
||||||
|
echo "#!/usr/bin/env bash
|
||||||
|
rm -rf /var/log/*
|
||||||
|
" >/etc/cron.hourly/clear-logs
|
||||||
|
chmod +x /etc/cron.hourly/clear-logs;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "${logging_mode}" in
|
||||||
|
rsyslog-client )
|
||||||
|
queue_apt_install "rsyslog" "rsyslog-gnutls";
|
||||||
|
|
||||||
|
do_ramlog
|
||||||
|
;;
|
||||||
|
|
||||||
|
ramlog )
|
||||||
|
do_ramlog
|
||||||
|
;;
|
||||||
|
|
||||||
|
none )
|
||||||
|
if ! command_exists logrotate; then
|
||||||
|
task_begin "Installing logrotate";
|
||||||
|
|
||||||
|
queue_apt_install logrotate;
|
||||||
|
|
||||||
|
mkdir -p /etc/logrotate.d;
|
||||||
|
touch /etc/logrotate.d/misc;
|
||||||
|
|
||||||
|
task_end "$?" "Failed to configure installation of logrotate";
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Finish this off.
|
13
src/steps-postinstall/100-logging.sh
Executable file
13
src/steps-postinstall/100-logging.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#shellcheck disable=2154
|
||||||
|
case "${logging_mode}" in
|
||||||
|
rsyslog-client )
|
||||||
|
if [[ -r "/etc/rsyslog.conf" ]]; then
|
||||||
|
mv /etc/rsyslog.conf /etc/rsyslog.conf.dpkg-dist;
|
||||||
|
fi
|
||||||
|
cp configs/rsyslog-client.conf /etc/rsyslog.conf
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
systemctl restart rsyslog;
|
Loading…
Reference in a new issue