mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Handle rsyslog format tags
This commit is contained in:
@@ -12,3 +12,5 @@ On Debian systems, use a syslog restart to tell it to re-open log files, as a HU
|
||||
On Fedora 8, use rsyslog by default instead of syslog.
|
||||
---- Changes since 1.430 ----
|
||||
Added support for rsyslogd, as seen by default on Debian 5.0.
|
||||
---- Changes since 1.480 ----
|
||||
Rsyslog format tags in the config file are now recogized and preserved, rather than being included in the log filename.
|
||||
|
||||
@@ -209,6 +209,7 @@ else {
|
||||
else {
|
||||
&can_edit_log($log) || &error($text{'save_ecannot4'});
|
||||
$old = $conf->[$in{'idx'}];
|
||||
$log->{'format'} = $old->{'format'}; # Copy for now
|
||||
&can_edit_log($old) || &error($text{'save_ecannot5'});
|
||||
&update_log($old, $log);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ while($line = <CONF>) {
|
||||
if ($line =~ /^\$(\S+)\s*(\S*)/) {
|
||||
# rsyslog special directive - ignored for now
|
||||
}
|
||||
elsif ($line =~ /^if\s+/) {
|
||||
# rsyslog if statement .. ignored too
|
||||
}
|
||||
elsif ($line =~ /^(#*)\s*([^#\s]+\.\S+)\s+(\S+)$/ ||
|
||||
$line =~ /^(#*)\s*([^#\s]+\.\S+)\s+(\|.*)$/) {
|
||||
# Regular log destination
|
||||
@@ -69,6 +72,11 @@ while($line = <CONF>) {
|
||||
$log->{'index'} = scalar(@rv);
|
||||
$log->{'section'} = $tag;
|
||||
$tag->{'eline'} = $lnum;
|
||||
if ($log->{'file'} =~ s/^(\/\S+);(\S+)$/$1/ ||
|
||||
$log->{'pipe'} =~ s/^(\/\S+);(\S+)$/$1/) {
|
||||
# rsyslog file format
|
||||
$log->{'format'} = $2;
|
||||
}
|
||||
push(@rv, $log);
|
||||
}
|
||||
elsif ($line =~ /^(#?)!(\S+)$/) {
|
||||
@@ -152,6 +160,10 @@ elsif ($_[0]->{'socket'}) {
|
||||
else {
|
||||
$d = '*';
|
||||
}
|
||||
if ($_[0]->{'format'}) {
|
||||
# Add rsyslog format
|
||||
$d .= ";".$_[0]->{'format'};
|
||||
}
|
||||
return ($_[0]->{'active'} ? "" : "#").join(";", @{$_[0]->{'sel'}})."\t".$d;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user