From: Christian Schmidt Date: Tue, 16 Mar 2010 20:09:44 +0000 (+0100) Subject: Added ability to change syslog to async logging. X-Git-Tag: v2.9-beta1~412^2~19 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=6945083ea536800184d56cab513176b5718b9eaf Added ability to change syslog to async logging. --- diff --git a/html/cgi-bin/logs.cgi/config.dat b/html/cgi-bin/logs.cgi/config.dat index f39981ed0e..392edac3da 100644 --- a/html/cgi-bin/logs.cgi/config.dat +++ b/html/cgi-bin/logs.cgi/config.dat @@ -32,6 +32,7 @@ $logsettings{'LOGWATCH_LEVEL'} = 'Low'; $logsettings{'LOGWATCH_KEEP'} = '56'; my @VS = ('15','50','100','150','250','500'); $logsettings{'ENABLE_REMOTELOG'} = 'off'; +$logsettings{'ENABLE_ASYNCLOG'} = 'off'; $logsettings{'REMOTELOG_ADDR'} = ''; $logsettings{'VARMESSAGES'} = 'cron.none;daemon.*;local0.*;local2.*;*.info;mail.none;authpriv.*'; $logsettings{'ACTION'} = ''; @@ -66,6 +67,10 @@ if ($logsettings{'ACTION'} eq $Lang::tr{'save'}) &General::readhash("${General::swroot}/logging/settings", \%logsettings); +$checked{'ENABLE_ASYNCLOG'}{'off'} = ''; +$checked{'ENABLE_ASYNCLOG'}{'on'} = ''; +$checked{'ENABLE_ASYNCLOG'}{$logsettings{'ENABLE_ASYNCLOG'}} = "checked='checked'"; + $checked{'ENABLE_REMOTELOG'}{'off'} = ''; $checked{'ENABLE_REMOTELOG'}{'on'} = ''; $checked{'ENABLE_REMOTELOG'}{$logsettings{'ENABLE_REMOTELOG'}} = "checked='checked'"; @@ -150,6 +155,7 @@ END print < + $Lang::tr{'enabled'} $Lang::tr{'log var messages'} diff --git a/src/misc-progs/syslogdctrl.c b/src/misc-progs/syslogdctrl.c index 9880ee2ee6..0e10e160b5 100644 --- a/src/misc-progs/syslogdctrl.c +++ b/src/misc-progs/syslogdctrl.c @@ -123,9 +123,13 @@ int main(void) close(config_fd); /* Replace the logging option*/ - safe_system("grep -v '/var/log/messages' < /etc/syslog.conf.new > /etc/syslog.conf.tmp && mv /etc/syslog.conf.tmp /etc/syslog.conf.new"); + + if (strcmp(ENABLE_ASYNCLOG,"on")) + snprintf(command, STRING_SIZE-1, "printf '%s -/var/log/messages' >> /etc/syslog.conf.new", varmessages ); + else snprintf(command, STRING_SIZE-1, "printf '%s /var/log/messages' >> /etc/syslog.conf.new", varmessages ); + safe_system(command); if (rename("/etc/syslog.conf.new", "/etc/syslog.conf") == -1)