From ca2d32ad44d28658dc7c994e06336f417788d2e8 Mon Sep 17 00:00:00 2001 From: Chiradeep Vittal Date: Wed, 12 Jan 2011 11:14:12 -0800 Subject: [PATCH 1/4] initial debian config for logging --- .../systemvm/debian/config/etc/logrotate.conf | 32 +++++ .../debian/config/etc/logrotate.d/apache2 | 13 ++ .../debian/config/etc/logrotate.d/ppp | 9 ++ .../debian/config/etc/logrotate.d/rsyslog | 37 ++++++ .../systemvm/debian/config/etc/rsyslog.conf | 116 ++++++++++++++++++ 5 files changed, 207 insertions(+) create mode 100644 patches/systemvm/debian/config/etc/logrotate.conf create mode 100644 patches/systemvm/debian/config/etc/logrotate.d/apache2 create mode 100644 patches/systemvm/debian/config/etc/logrotate.d/ppp create mode 100644 patches/systemvm/debian/config/etc/logrotate.d/rsyslog create mode 100644 patches/systemvm/debian/config/etc/rsyslog.conf diff --git a/patches/systemvm/debian/config/etc/logrotate.conf b/patches/systemvm/debian/config/etc/logrotate.conf new file mode 100644 index 00000000000..4bd60ab4e4e --- /dev/null +++ b/patches/systemvm/debian/config/etc/logrotate.conf @@ -0,0 +1,32 @@ +# see "man logrotate" for details +# rotate log files weekly +weekly + +# keep 4 weeks worth of backlogs +rotate 4 + +# create new (empty) log files after rotating old ones +create + +# uncomment this if you want your log files compressed +#compress + +# packages drop log rotation information into this directory +include /etc/logrotate.d + +# no packages own wtmp, or btmp -- we'll rotate them here +/var/log/wtmp { + missingok + monthly + create 0664 root utmp + rotate 1 +} + +/var/log/btmp { + missingok + monthly + create 0660 root utmp + rotate 1 +} + +# system-specific logs may be configured here diff --git a/patches/systemvm/debian/config/etc/logrotate.d/apache2 b/patches/systemvm/debian/config/etc/logrotate.d/apache2 new file mode 100644 index 00000000000..f2dd950bf26 --- /dev/null +++ b/patches/systemvm/debian/config/etc/logrotate.d/apache2 @@ -0,0 +1,13 @@ +/var/log/apache2/*.log { + weekly + missingok + rotate 52 + compress + delaycompress + notifempty + create 640 root adm + sharedscripts + postrotate + /etc/init.d/apache2 reload > /dev/null + endscript +} diff --git a/patches/systemvm/debian/config/etc/logrotate.d/ppp b/patches/systemvm/debian/config/etc/logrotate.d/ppp new file mode 100644 index 00000000000..35054639a4d --- /dev/null +++ b/patches/systemvm/debian/config/etc/logrotate.d/ppp @@ -0,0 +1,9 @@ +/var/log/ppp-connect-errors { + weekly + rotate 4 + missingok + notifempty + compress + nocreate +} + diff --git a/patches/systemvm/debian/config/etc/logrotate.d/rsyslog b/patches/systemvm/debian/config/etc/logrotate.d/rsyslog new file mode 100644 index 00000000000..9ce5a447a43 --- /dev/null +++ b/patches/systemvm/debian/config/etc/logrotate.d/rsyslog @@ -0,0 +1,37 @@ +/var/log/syslog +{ + rotate 7 + daily + missingok + notifempty + delaycompress + compress + postrotate + invoke-rc.d rsyslog reload > /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 + invoke-rc.d rsyslog reload > /dev/null + endscript +} diff --git a/patches/systemvm/debian/config/etc/rsyslog.conf b/patches/systemvm/debian/config/etc/rsyslog.conf new file mode 100644 index 00000000000..2a7f9f9867d --- /dev/null +++ b/patches/systemvm/debian/config/etc/rsyslog.conf @@ -0,0 +1,116 @@ +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html + + +################# +#### MODULES #### +################# + +$ModLoad imuxsock # provides support for local system logging +$ModLoad imklog # provides kernel logging support (previously done by rklogd) +#$ModLoad immark # provides --MARK-- message capability + +# provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + + +############### +#### RULES #### +############### + +# +# First some standard log files. Log by facility. +# +auth,authpriv.* /var/log/auth.log +*.*;auth,authpriv.none -/var/log/syslog +#cron.* /var/log/cron.log +daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +lpr.* -/var/log/lpr.log +mail.* -/var/log/mail.log +user.* -/var/log/user.log + +# +# Logging for the mail system. Split it up so that +# it is easy to write scripts to parse these files. +# +mail.info -/var/log/mail.info +mail.warn -/var/log/mail.warn +mail.err /var/log/mail.err + +# +# Logging for INN news system. +# +news.crit /var/log/news/news.crit +news.err /var/log/news/news.err +news.notice -/var/log/news/news.notice + +# +# Some "catch-all" log files. +# +*.=debug;\ + auth,authpriv.none;\ + news.none;mail.none -/var/log/debug +*.=info;*.=notice;*.=warn;\ + auth,authpriv.none;\ + cron,daemon.none;\ + mail,news.none -/var/log/messages + +# +# Emergencies are sent to everybody logged in. +# +*.emerg * + +# +# I like to have messages displayed on the console, but only on a virtual +# console I usually leave idle. +# +#daemon,mail.*;\ +# news.=crit;news.=err;news.=notice;\ +# *.=debug;*.=info;\ +# *.=notice;*.=warn /dev/tty8 + +# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, +# you must invoke `xconsole' with the `-file' option: +# +# $ xconsole -file /dev/xconsole [...] +# +# NOTE: adjust the list below, or you'll go crazy if you have a reasonably +# busy site.. +# +daemon.*;mail.*;\ + news.err;\ + *.=debug;*.=info;\ + *.=notice;*.=warn |/dev/xconsole From 6ecbbe0b37bd8031d7adfa3539b90d272e007474 Mon Sep 17 00:00:00 2001 From: Chiradeep Vittal Date: Wed, 12 Jan 2011 11:15:08 -0800 Subject: [PATCH 2/4] Add logrotate for dnsmasq and haproxy --- .../systemvm/debian/config/etc/logrotate.d/dnsmasq | 13 +++++++++++++ .../systemvm/debian/config/etc/logrotate.d/haproxy | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 patches/systemvm/debian/config/etc/logrotate.d/dnsmasq create mode 100644 patches/systemvm/debian/config/etc/logrotate.d/haproxy diff --git a/patches/systemvm/debian/config/etc/logrotate.d/dnsmasq b/patches/systemvm/debian/config/etc/logrotate.d/dnsmasq new file mode 100644 index 00000000000..f448420e176 --- /dev/null +++ b/patches/systemvm/debian/config/etc/logrotate.d/dnsmasq @@ -0,0 +1,13 @@ +/var/log/dnsmasq.log { + daily + missingok + rotate 5 + notifempty + delaycompress + sharedscripts + postrotate + [ ! -f /var/run/dnsmasq.pid ] || kill -USR2 `cat /var/run/dnsmasq.pid` + endscript + create 0640 nobody root +} + diff --git a/patches/systemvm/debian/config/etc/logrotate.d/haproxy b/patches/systemvm/debian/config/etc/logrotate.d/haproxy new file mode 100644 index 00000000000..858fe2a1c3a --- /dev/null +++ b/patches/systemvm/debian/config/etc/logrotate.d/haproxy @@ -0,0 +1,10 @@ +/var/log/haproxy.log { + daily + rotate 5 + missingok + notifempty + size 10M + postrotate + /bin/kill -HUP `cat /var/run/rsyslog.pid 2> /dev/null` 2> /dev/null || true + endscript +} From 1934e799003109a330c8a3d05dd6794d4edc485a Mon Sep 17 00:00:00 2001 From: Chiradeep Vittal Date: Wed, 12 Jan 2011 11:17:06 -0800 Subject: [PATCH 3/4] bug 7141: rotate logs --- .../systemvm/debian/config/etc/logrotate.conf | 23 ++++++++----- .../systemvm/debian/config/etc/rsyslog.conf | 34 +++++++------------ 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/patches/systemvm/debian/config/etc/logrotate.conf b/patches/systemvm/debian/config/etc/logrotate.conf index 4bd60ab4e4e..f5a660964d3 100644 --- a/patches/systemvm/debian/config/etc/logrotate.conf +++ b/patches/systemvm/debian/config/etc/logrotate.conf @@ -1,22 +1,27 @@ # see "man logrotate" for details -# rotate log files weekly -weekly +# rotate log files daily +daily -# keep 4 weeks worth of backlogs -rotate 4 +# keep 5 days worth +rotate 5 # create new (empty) log files after rotating old ones create +# use date as a suffix of the rotated file +dateext + # uncomment this if you want your log files compressed #compress -# packages drop log rotation information into this directory +# max size 50M +size 50M + +# RPM packages drop log rotation information into this directory include /etc/logrotate.d -# no packages own wtmp, or btmp -- we'll rotate them here +# no packages own wtmp and btmp -- we'll rotate them here /var/log/wtmp { - missingok monthly create 0664 root utmp rotate 1 @@ -25,8 +30,8 @@ include /etc/logrotate.d /var/log/btmp { missingok monthly - create 0660 root utmp + create 0600 root utmp rotate 1 } -# system-specific logs may be configured here +# system-specific logs may be also be configured here. diff --git a/patches/systemvm/debian/config/etc/rsyslog.conf b/patches/systemvm/debian/config/etc/rsyslog.conf index 2a7f9f9867d..8dc7c7504ca 100644 --- a/patches/systemvm/debian/config/etc/rsyslog.conf +++ b/patches/systemvm/debian/config/etc/rsyslog.conf @@ -13,8 +13,8 @@ $ModLoad imklog # provides kernel logging support (previously done by rklogd) #$ModLoad immark # provides --MARK-- message capability # provides UDP syslog reception -#$ModLoad imudp -#$UDPServerRun 514 +$ModLoad imudp +$UDPServerRun 3914 # provides TCP syslog reception #$ModLoad imtcp @@ -54,13 +54,13 @@ $IncludeConfig /etc/rsyslog.d/*.conf # First some standard log files. Log by facility. # auth,authpriv.* /var/log/auth.log -*.*;auth,authpriv.none -/var/log/syslog -#cron.* /var/log/cron.log +#*.*;auth,authpriv.none -/var/log/syslog +cron.* /var/log/cron.log daemon.* -/var/log/daemon.log kern.* -/var/log/kern.log lpr.* -/var/log/lpr.log mail.* -/var/log/mail.log -user.* -/var/log/user.log +#user.* -/var/log/user.log # # Logging for the mail system. Split it up so that @@ -80,13 +80,14 @@ news.notice -/var/log/news/news.notice # # Some "catch-all" log files. # -*.=debug;\ - auth,authpriv.none;\ - news.none;mail.none -/var/log/debug +#*.=debug;\ +# auth,authpriv.none;\ +# news.none;mail.none -/var/log/debug *.=info;*.=notice;*.=warn;\ auth,authpriv.none;\ - cron,daemon.none;\ - mail,news.none -/var/log/messages + cron.none,daemon.none;\ + local0.none,daemon.none;\ + mail.none,news.none -/var/log/messages # # Emergencies are sent to everybody logged in. @@ -102,15 +103,4 @@ news.notice -/var/log/news/news.notice # *.=debug;*.=info;\ # *.=notice;*.=warn /dev/tty8 -# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, -# you must invoke `xconsole' with the `-file' option: -# -# $ xconsole -file /dev/xconsole [...] -# -# NOTE: adjust the list below, or you'll go crazy if you have a reasonably -# busy site.. -# -daemon.*;mail.*;\ - news.err;\ - *.=debug;*.=info;\ - *.=notice;*.=warn |/dev/xconsole +local0.* -/var/log/haproxy.log From b00e2f734e328c6b953d95e741842c28417a44cc Mon Sep 17 00:00:00 2001 From: Chiradeep Vittal Date: Wed, 12 Jan 2011 12:18:31 -0800 Subject: [PATCH 4/4] Automate vmware systemvm appliance generation --- patches/systemvm/debian/convert.sh | 13 ++++++---- patches/systemvm/debian/systemvm.vmx | 37 ++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 patches/systemvm/debian/systemvm.vmx diff --git a/patches/systemvm/debian/convert.sh b/patches/systemvm/debian/convert.sh index c3fe1c6c13d..3d7dac7f487 100755 --- a/patches/systemvm/debian/convert.sh +++ b/patches/systemvm/debian/convert.sh @@ -17,9 +17,13 @@ bzip2 -c systemvm.qcow2 > systemvm.qcow2.bz2 echo "Done qcow2" echo "Converting raw image to vmdk" qemu-img convert -f raw -O vmdk systemvm.img systemvm.vmdk -echo "Compressing vmdk..." -bzip2 -c systemvm.vmdk > systemvm.vmdk.bz2 -echo "Done vmdk" +echo "Done creating vmdk" +echo "Creating ova appliance " +ovftool systemvm.vmx systemvm.ova +echo "Done creating OVA" +echo "Cleaning up..." +rm -vf systemvm.vmdk +rm -vf systemvm.vhd.bak echo "Compressing raw image..." bzip2 -c systemvm.img > systemvm.img.bz2 @@ -32,5 +36,4 @@ md5sum systemvm.vhd >> md5sum md5sum systemvm.vhd.bz2 >> md5sum md5sum systemvm.qcow2 >> md5sum md5sum systemvm.qcow2.bz2 >> md5sum -md5sum systemvm.vmdk >> md5sum -md5sum systemvm.vmdk.bz2 >> md5sum +md5sum systemvm.ova >> md5sum diff --git a/patches/systemvm/debian/systemvm.vmx b/patches/systemvm/debian/systemvm.vmx new file mode 100644 index 00000000000..9b93449d94a --- /dev/null +++ b/patches/systemvm/debian/systemvm.vmx @@ -0,0 +1,37 @@ +config.version = "8" +displayname = "systemvm" +ethernet0.addressType = "generated" +ethernet0.connectionType = "bridged" +ethernet0.present = "true" +ethernet0.startConnected = "true" +ethernet0.virtualDev = "e1000" +floppy0.autodetect = "false" +floppy0.fileType = "device" +floppy0.present = "true" +floppy0.startConnected = "false" +guestos = "debian5" +ide0:0.deviceType = "disk" +ide0:0.fileName = "systemvm.vmdk" +ide0:0.present = "true" +ide1:0.autodetect = "true" +ide1:0.deviceType = "atapi-cdrom" +ide1:0.present = "true" +ide1:0.startConnected = "false" +memsize = "256" +numvcpus = "1" +pciBridge0.present = "TRUE" +pciBridge4.functions = "8" +pciBridge4.present = "TRUE" +pciBridge4.virtualDev = "pcieRootPort" +pciBridge5.functions = "8" +pciBridge5.present = "TRUE" +pciBridge5.virtualDev = "pcieRootPort" +pciBridge6.functions = "8" +pciBridge6.present = "TRUE" +pciBridge6.virtualDev = "pcieRootPort" +pciBridge7.functions = "8" +pciBridge7.present = "TRUE" +pciBridge7.virtualDev = "pcieRootPort" +svga.autodetect = "true" +virtualhw.version = "7" +vmci0.present = "TRUE"