Added ability to change syslog to async logging.
authorChristian Schmidt <maniacikarus@ipfire.org>
Tue, 16 Mar 2010 20:09:44 +0000 (21:09 +0100)
committerChristian Schmidt <maniacikarus@ipfire.org>
Tue, 16 Mar 2010 20:09:44 +0000 (21:09 +0100)
html/cgi-bin/logs.cgi/config.dat
src/misc-progs/syslogdctrl.c

index f39981e..392edac 100644 (file)
@@ -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 <<END
 <table width='100%'>
 <tr>
+  <td class='base'>$Lang::tr{'enabled'}</td><td><input type='checkbox' name='ENABLE_ASYNCLOG' $checked{'ENABLE_ASYNCLOG'}{'on'} /></td>
   <td>$Lang::tr{'log var messages'}</td><td><input type='text' name='VARMESSAGES' size='50' value='$logsettings{'VARMESSAGES'}' /></td>
 </tr>
 </table>
index 9880ee2..0e10e16 100644 (file)
@@ -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)