mirror of
/repos/baseimage-docker.git
synced 2026-02-27 17:41:59 +01:00
Made services installation optional during build
You can user `ENV` directive in Dockerfile to disable the installation for some services or change `image/buildconfig`. The flags are : DISABLE_SSHD DISABLE_CRON DISABLE_SYSLOG
This commit is contained in:
38
image/services/syslog-ng/logrotate_syslogng
Normal file
38
image/services/syslog-ng/logrotate_syslogng
Normal file
@@ -0,0 +1,38 @@
|
||||
/var/log/syslog
|
||||
{
|
||||
rotate 7
|
||||
daily
|
||||
missingok
|
||||
notifempty
|
||||
delaycompress
|
||||
compress
|
||||
postrotate
|
||||
sv reload syslog-ng > /dev/null
|
||||
endscript
|
||||
}
|
||||
|
||||
/var/log/mail.info
|
||||
/var/log/mail.warn
|
||||
/var/log/mail.err
|
||||
/var/log/mail.log
|
||||
/var/log/daemon.log
|
||||
/var/log/kern.log
|
||||
/var/log/auth.log
|
||||
/var/log/user.log
|
||||
/var/log/lpr.log
|
||||
/var/log/cron.log
|
||||
/var/log/debug
|
||||
/var/log/messages
|
||||
{
|
||||
rotate 4
|
||||
weekly
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
sharedscripts
|
||||
postrotate
|
||||
sv reload syslog-ng > /dev/null
|
||||
sv restart cron-log-forwarder > /dev/null
|
||||
endscript
|
||||
}
|
||||
2
image/services/syslog-ng/syslog-forwarder.runit
Executable file
2
image/services/syslog-ng/syslog-forwarder.runit
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec tail -F -n 0 /var/log/syslog
|
||||
148
image/services/syslog-ng/syslog-ng.conf
Normal file
148
image/services/syslog-ng/syslog-ng.conf
Normal file
@@ -0,0 +1,148 @@
|
||||
@version: 3.5
|
||||
@include "scl.conf"
|
||||
@include "`scl-root`/system/tty10.conf"
|
||||
|
||||
# Syslog-ng configuration file, compatible with default Debian syslogd
|
||||
# installation.
|
||||
|
||||
# First, set some global options.
|
||||
options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no);
|
||||
owner("root"); group("adm"); perm(0640); stats_freq(0);
|
||||
bad_hostname("^gconfd$");
|
||||
};
|
||||
|
||||
########################
|
||||
# Sources
|
||||
########################
|
||||
# This is the default behavior of sysklogd package
|
||||
# Logs may come from unix stream, but not from another machine.
|
||||
#
|
||||
source s_src {
|
||||
unix-stream("/dev/log");
|
||||
internal();
|
||||
};
|
||||
|
||||
# If you wish to get logs from remote machine you should uncomment
|
||||
# this and comment the above source line.
|
||||
#
|
||||
#source s_net { tcp(ip(127.0.0.1) port(1000)); };
|
||||
|
||||
########################
|
||||
# Destinations
|
||||
########################
|
||||
# First some standard logfile
|
||||
#
|
||||
destination d_auth { file("/var/log/auth.log"); };
|
||||
destination d_cron { file("/var/log/cron.log"); };
|
||||
destination d_daemon { file("/var/log/daemon.log"); };
|
||||
destination d_kern { file("/var/log/kern.log"); };
|
||||
destination d_lpr { file("/var/log/lpr.log"); };
|
||||
destination d_mail { file("/var/log/mail.log"); };
|
||||
destination d_syslog { file("/var/log/syslog"); };
|
||||
destination d_user { file("/var/log/user.log"); };
|
||||
destination d_uucp { file("/var/log/uucp.log"); };
|
||||
|
||||
# This files are the log come from the mail subsystem.
|
||||
#
|
||||
destination d_mailinfo { file("/var/log/mail.info"); };
|
||||
destination d_mailwarn { file("/var/log/mail.warn"); };
|
||||
destination d_mailerr { file("/var/log/mail.err"); };
|
||||
|
||||
# Logging for INN news system
|
||||
#
|
||||
destination d_newscrit { file("/var/log/news/news.crit"); };
|
||||
destination d_newserr { file("/var/log/news/news.err"); };
|
||||
destination d_newsnotice { file("/var/log/news/news.notice"); };
|
||||
|
||||
# Some `catch-all' logfiles.
|
||||
#
|
||||
destination d_debug { file("/var/log/debug"); };
|
||||
destination d_error { file("/var/log/error"); };
|
||||
destination d_messages { file("/var/log/messages"); };
|
||||
|
||||
# The named pipe /dev/xconsole is for the nsole' utility. To use it,
|
||||
# you must invoke nsole' with the -file' option:
|
||||
#
|
||||
# $ xconsole -file /dev/xconsole [...]
|
||||
#
|
||||
destination d_xconsole { pipe("/dev/xconsole"); };
|
||||
|
||||
# Send the messages to an other host
|
||||
#
|
||||
#destination d_net { tcp("127.0.0.1" port(1000) log_fifo_size(1000)); };
|
||||
|
||||
# Debian only
|
||||
destination d_ppp { file("/var/log/ppp.log"); };
|
||||
|
||||
########################
|
||||
# Filters
|
||||
########################
|
||||
# Here's come the filter options. With this rules, we can set which
|
||||
# message go where.
|
||||
|
||||
filter f_dbg { level(debug); };
|
||||
filter f_info { level(info); };
|
||||
filter f_notice { level(notice); };
|
||||
filter f_warn { level(warn); };
|
||||
filter f_err { level(err); };
|
||||
filter f_crit { level(crit .. emerg); };
|
||||
|
||||
filter f_debug { level(debug) and not facility(auth, authpriv, news, mail); };
|
||||
filter f_error { level(err .. emerg) ; };
|
||||
filter f_messages { level(info,notice,warn) and
|
||||
not facility(auth,authpriv,cron,daemon,mail,news); };
|
||||
|
||||
filter f_auth { facility(auth, authpriv) and not filter(f_debug); };
|
||||
filter f_cron { facility(cron) and not filter(f_debug); };
|
||||
filter f_daemon { facility(daemon) and not filter(f_debug); };
|
||||
filter f_kern { facility(kern) and not filter(f_debug); };
|
||||
filter f_lpr { facility(lpr) and not filter(f_debug); };
|
||||
filter f_local { facility(local0, local1, local3, local4, local5,
|
||||
local6, local7) and not filter(f_debug); };
|
||||
filter f_mail { facility(mail) and not filter(f_debug); };
|
||||
filter f_news { facility(news) and not filter(f_debug); };
|
||||
filter f_syslog3 { not facility(auth, authpriv, mail) and not filter(f_debug); };
|
||||
filter f_user { facility(user) and not filter(f_debug); };
|
||||
filter f_uucp { facility(uucp) and not filter(f_debug); };
|
||||
|
||||
filter f_cnews { level(notice, err, crit) and facility(news); };
|
||||
filter f_cother { level(debug, info, notice, warn) or facility(daemon, mail); };
|
||||
|
||||
filter f_ppp { facility(local2) and not filter(f_debug); };
|
||||
filter f_console { level(warn .. emerg); };
|
||||
|
||||
########################
|
||||
# Log paths
|
||||
########################
|
||||
log { source(s_src); filter(f_auth); destination(d_auth); };
|
||||
log { source(s_src); filter(f_cron); destination(d_cron); };
|
||||
log { source(s_src); filter(f_daemon); destination(d_daemon); };
|
||||
log { source(s_src); filter(f_kern); destination(d_kern); };
|
||||
log { source(s_src); filter(f_lpr); destination(d_lpr); };
|
||||
log { source(s_src); filter(f_syslog3); destination(d_syslog); };
|
||||
log { source(s_src); filter(f_user); destination(d_user); };
|
||||
log { source(s_src); filter(f_uucp); destination(d_uucp); };
|
||||
|
||||
log { source(s_src); filter(f_mail); destination(d_mail); };
|
||||
#log { source(s_src); filter(f_mail); filter(f_info); destination(d_mailinfo); };
|
||||
#log { source(s_src); filter(f_mail); filter(f_warn); destination(d_mailwarn); };
|
||||
#log { source(s_src); filter(f_mail); filter(f_err); destination(d_mailerr); };
|
||||
|
||||
log { source(s_src); filter(f_news); filter(f_crit); destination(d_newscrit); };
|
||||
log { source(s_src); filter(f_news); filter(f_err); destination(d_newserr); };
|
||||
log { source(s_src); filter(f_news); filter(f_notice); destination(d_newsnotice); };
|
||||
|
||||
#log { source(s_src); filter(f_ppp); destination(d_ppp); };
|
||||
|
||||
log { source(s_src); filter(f_debug); destination(d_debug); };
|
||||
log { source(s_src); filter(f_error); destination(d_error); };
|
||||
log { source(s_src); filter(f_messages); destination(d_messages); };
|
||||
|
||||
# All messages send to a remote site
|
||||
#
|
||||
#log { source(s_src); destination(d_net); };
|
||||
|
||||
###
|
||||
# Include all config files in /etc/syslog-ng/conf.d/
|
||||
###
|
||||
@include "/etc/syslog-ng/conf.d/*.conf"
|
||||
32
image/services/syslog-ng/syslog-ng.runit
Executable file
32
image/services/syslog-ng/syslog-ng.runit
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# If /dev/log is either a named pipe or it was placed there accidentally,
|
||||
# e.g. because of the issue documented at https://github.com/phusion/baseimage-docker/pull/25,
|
||||
# then we remove it.
|
||||
if [ ! -S /dev/log ]; then rm -f /dev/log; fi
|
||||
if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/syslog-ng.ctl; fi
|
||||
|
||||
SYSLOGNG_OPTS=""
|
||||
|
||||
[ -r /etc/default/syslog-ng ] && . /etc/default/syslog-ng
|
||||
|
||||
case "x$CONSOLE_LOG_LEVEL" in
|
||||
x[1-8])
|
||||
dmesg -n $CONSOLE_LOG_LEVEL
|
||||
;;
|
||||
x)
|
||||
;;
|
||||
*)
|
||||
echo "CONSOLE_LOG_LEVEL is of unaccepted value."
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -e /dev/xconsole ]
|
||||
then
|
||||
mknod -m 640 /dev/xconsole p
|
||||
chown root:adm /dev/xconsole
|
||||
[ -x /sbin/restorecon ] && /sbin/restorecon $XCONSOLE
|
||||
fi
|
||||
|
||||
exec syslog-ng -F -p /var/run/syslog-ng.pid $SYSLOGNG_OPTS
|
||||
24
image/services/syslog-ng/syslog-ng.sh
Executable file
24
image/services/syslog-ng/syslog-ng.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
source /bd_build/buildconfig
|
||||
set -x
|
||||
|
||||
SYSLOG_NG_BUILD_PATH=/bd_build/services/syslog-ng
|
||||
|
||||
## Install a syslog daemon.
|
||||
$minimal_apt_get_install syslog-ng-core
|
||||
mkdir /etc/service/syslog-ng
|
||||
cp $SYSLOG_NG_BUILD_PATH/syslog-ng.runit /etc/service/syslog-ng/run
|
||||
mkdir -p /var/lib/syslog-ng
|
||||
cp $SYSLOG_NG_BUILD_PATH/syslog_ng_default /etc/default/syslog-ng
|
||||
touch /var/log/syslog
|
||||
chmod u=rw,g=r,o= /var/log/syslog
|
||||
cp $SYSLOG_NG_BUILD_PATH/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
|
||||
|
||||
## Install syslog to "docker logs" forwarder.
|
||||
mkdir /etc/service/syslog-forwarder
|
||||
cp $SYSLOG_NG_BUILD_PATH/syslog-forwarder.runit /etc/service/syslog-forwarder/run
|
||||
|
||||
## Install logrotate.
|
||||
$minimal_apt_get_install logrotate
|
||||
cp $SYSLOG_NG_BUILD_PATH/logrotate_syslogng /etc/logrotate.d/syslog-ng
|
||||
12
image/services/syslog-ng/syslog_ng_default
Normal file
12
image/services/syslog-ng/syslog_ng_default
Normal file
@@ -0,0 +1,12 @@
|
||||
# If a variable is not set here, then the corresponding
|
||||
# parameter will not be changed.
|
||||
# If a variables is set, then every invocation of
|
||||
# syslog-ng's init script will set them using dmesg.
|
||||
|
||||
# log level of messages which should go to console
|
||||
# see syslog(3) for details
|
||||
#
|
||||
#CONSOLE_LOG_LEVEL=1
|
||||
|
||||
# Command line options to syslog-ng
|
||||
SYSLOGNG_OPTS="--no-caps"
|
||||
Reference in New Issue
Block a user