X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Flogs.cgi%2Flog.dat;h=8405c8fbbb140e0b424cbdcf30e74703d9dcc519;hb=7f0974a23a7eb07effb516f40ebf757f521a2108;hp=87701ad4487ad642c53147f2e9a3ba302bfe0b9c;hpb=cd1a2927226c734d96478e12bb768256fb64a06a;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat index 87701ad448..8405c8fbbb 100644 --- a/html/cgi-bin/logs.cgi/log.dat +++ b/html/cgi-bin/logs.cgi/log.dat @@ -12,13 +12,18 @@ use strict; # enable only the following on debugging purpose -#use warnings; -#use CGI::Carp 'fatalsToBrowser'; +use warnings; +use CGI::Carp 'fatalsToBrowser'; -require 'CONFIG_ROOT/general-functions.pl'; +require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +my %color = (); +my %mainsettings = (); +&General::readhash("${General::swroot}/main/settings", \%mainsettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); + use POSIX(); #workaround to suppress a warning when a variable is used only once @@ -45,37 +50,43 @@ my $year = $now[5]+1900; $cgiparams{'DAY'} = $now[3]; $cgiparams{'MONTH'} = $now[4]; $cgiparams{'ACTION'} = ''; -$cgiparams{'SECTION'} = 'ipcop'; +$cgiparams{'SECTION'} = 'ipfire'; my %sections = ( - 'ipcop' => '(ipcop)', - 'red' => '(red.*|kernel: usb.*|pppd\[.*\]|chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|pppoa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: isdn.*|ibod\[.*\]|kernel: eth.*|dhcpcd\[.*\]|modem_run\[.*\])', - 'dns' => '(dnsmasq\[.*\])', - 'dhcp' => '(dhcpd)', - 'cron' => '(fcron\[.*\])', - 'ntp' => '(ntpd(?:ate)?\[.*\])', - 'ssh' => '(sshd(?:\(.*\))?\[.*\])', - 'auth' => '(\w+\(pam_unix\)\[.*\])', - 'kernel' => '(kernel)', - 'ipsec' => '(ipsec_[\w_]+|pluto\[.*\])', - 'snort' => '(snort)', - 'installpackage' => '(installpackage\[.*\])' + 'ipfire' => '(ipfire: )', + 'red' => '(red:|pppd\[.*\]: |chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|pppoa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: isdn.*|ibod\[.*\]|dhcpcd\[.*\]|modem_run\[.*\])', + 'dns' => '(dnsmasq\[.*\]: )', + 'dhcp' => '(dhcpd: )', + 'clamav' => '(clamd\[.*\]: |freshclam\[.*\]: )', + 'collectd' => '(collectd\[.*\]: )', + 'cron' => '(fcron\[.*\]: )', + 'ntp' => '(ntpd(?:ate)?\[.*\]: )', + 'ssh' => '(sshd(?:\(.*\))?\[.*\]: )', + 'auth' => '(\w+\(pam_unix\)\[.*\]: )', + 'kernel' => '(kernel: (?!DROP_))', + 'ipsec' => '(ipsec_[\w_]+: |pluto\[.*\]: |vpnwatch: )', + 'openvpn' => '(openvpnserver)\[.*\]: ', + 'pakfire' => '(pakfire:) ', + 'wireless' => '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:) ' ); # Translations for the %sections array. my %trsections = ( - 'ipcop' => 'IPCop', + 'ipfire' => 'IPFire', 'red' => 'RED', 'dns' => 'DNS', 'dhcp' => "$Lang::tr{'dhcp server'}", 'cron' => 'Cron', + 'collectd' => 'Collectd', + 'clamav' => 'ClamAV', 'ntp' => 'NTP', 'ssh' => 'SSH', 'auth' => "$Lang::tr{'loginlogout'}", 'kernel' => "$Lang::tr{'kernel'}", 'ipsec' => 'IPSec', - 'snort' => 'Snort', - 'installpackage' => "$Lang::tr{'update transcript'}" + 'openvpn' => 'OpenVPN', + 'pakfire' => 'Pakfire', + 'wireless' => 'Wireless' ); @@ -146,7 +157,7 @@ my $date = $cgiparams{'DAY'} == 0 ? '' : $cgiparams{'DAY'} <= 9 ? "0$cgiparams{ { my $xday; - + # Calculate time. If future date, calculate for past year !!! if (( $cgiparams{'MONTH'} eq $now[4]) && ($cgiparams{'DAY'} > $now[3]) || ( $cgiparams{'MONTH'} > $now[4] ) ) { @@ -166,7 +177,7 @@ my $date = $cgiparams{'DAY'} == 0 ? '' : $cgiparams{'DAY'} <= 9 ? "0$cgiparams{ # Convert delta in second to full weeks $gzindex = int (($sunday-$xday)/604800 ); } - + my $monthstr = $shortmonths[$cgiparams{'MONTH'}]; my $daystr = $cgiparams{'DAY'} == 0 ? '..' : $cgiparams{'DAY'} <= 9 ? " $cgiparams{'DAY'}" : "$cgiparams{'DAY'}"; my $section = $sections{$cgiparams{'SECTION'}}; @@ -178,7 +189,7 @@ my $loop = 1; my $filestr = 0; my $lastdatetime; # for debug my $search_for_end = 0; - + while ($gzindex >=0 && $loop) { # calculate file name if ($gzindex == 0) { @@ -192,7 +203,7 @@ while ($gzindex >=0 && $loop) { #&General::log("reading $filestr"); READ:while () { my $line = $_; - if ($line =~ /^${monthstr} ${daystr} ..:..:.. [\w\-]+ ${section}: (.*)/) { + if ($line =~ /^${monthstr} ${daystr} ..:..:.. [\w\-]+ ${section}(.*)/) { # when standart viewing, just keep in memory the correct slice # it starts a '$start' and size is $viewport # If export, then keep all lines... @@ -229,7 +240,7 @@ while ($gzindex >=0 && $loop) { if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}) { print "Content-type: text/plain\n\n"; - print "IPCop diagnostics\r\n"; + print "IPFire diagnostics\r\n"; print "$Lang::tr{'section'}: $cgiparams{'SECTION'}\n"; print "$Lang::tr{'date'}: $date\r\n\r\n"; @@ -237,18 +248,18 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}) foreach $_ (@log) { - /^... (..) (..:..:..) [\w\-]+ ${section}: (.*)$/; + /^... (..) (..:..:..) [\w\-]+ ${section}(.*)$/; my $day = $1; $day =~ tr / /0/; my $time = $cgiparams{'DAY'} ? "$2" : "$day/$2" ; - print "$time $3 $4\r\n"; + print "$time $3 $4\r\n"; } exit 0; } &Header::showhttpheaders(); -&Header::openpage($Lang::tr{'firewall log'}, 1, ''); +&Header::openpage($Lang::tr{'system logs'}, 1, ''); &Header::openbigbox('100%', 'left', '', $errormessage); @@ -299,7 +310,7 @@ print <$Lang::tr{'all'}\n"; -for (my $day = 1; $day <= 31; $day++) +for (my $day = 1; $day <= 31; $day++) { print "\t