From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Fischer To: development@lists.ipfire.org Subject: [PATCH] log.dat v3: cosmetical upgrade Date: Sun, 23 Oct 2016 00:17:38 +0200 Message-ID: <20161022221738.3306-1-matthias.fischer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6649043247019651366==" List-Id: --===============6649043247019651366== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Please note - this commit is an alternative to: http://git.ipfire.org/?p=3Dpeople/mfischer/ipfire-2.x.git;a=3Dcommit;h=3D972a= 3758e33e5e376d3f413bb81fd3f2f4e58c68 V3: Perhaps a solution for 'dnsmasq' and 'unbound'-output: I couldn't manage to get 'dnsmasq' and 'unbound' filtered through a one-liner, so I splitted them in two entries. 'DNS: dnsmasq' and 'DNS: unbound'. Best, Matthias Signed-off-by: Matthias Fischer --- html/cgi-bin/logs.cgi/log.dat | 70 +++++++++++++++++++++++------------------= -- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat index 82b6aa0..138bf9b 100644 --- a/html/cgi-bin/logs.cgi/log.dat +++ b/html/cgi-bin/logs.cgi/log.dat @@ -49,50 +49,54 @@ $cgiparams{'ACTION'} =3D ''; $cgiparams{'SECTION'} =3D 'ipfire'; =20 my %sections =3D ( - 'ipfire' =3D> '(ipfire: )', - 'red' =3D> '(red:|pppd\[.*\]: |chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|ppp= oa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: = isdn.*|ibod\[.*\]|dhcpcd\[.*\]|modem_run\[.*\])', - 'ddns' =3D> '(ddns\[\d+\]:)', - 'dns' =3D> '(dnsmasq\[.*\]: |unbound\[.*\]: )', - 'dma' =3D> '(dma\[.*\]: )', - 'dhcp' =3D> '(dhcpd: )', + 'auth' =3D> '(\w+\(pam_unix\)\[.*\]: )', 'clamav' =3D> '(clamd\[.*\]: |freshclam\[.*\]: )', 'collectd' =3D> '(collectd\[.*\]: )', 'cron' =3D> '(fcron\[.*\]: )', - 'ntp' =3D> '(ntpd(?:ate)?\[.*\]: )', - 'ssh' =3D> '(sshd(?:\(.*\))?\[.*\]: )', - 'auth' =3D> '(\w+\(pam_unix\)\[.*\]: )', - 'kernel' =3D> '(kernel: (?!DROP_))', + 'ddns' =3D> '(ddns\[\d+\]:)', + 'dhcp' =3D> '(dhcpd: )', + 'dma' =3D> '(dma\[.*\]: )', + 'dnsmasq' =3D> '(dnsmasq\[.*\]: )', + 'unbound' =3D> '(unbound: \[.*:.*\])(.*:.*$)', + 'guardian' =3D> '(guardian\[.*\]: )', + 'ipfire' =3D> '(ipfire: )', 'ipsec' =3D> '(ipsec_[\w_]+: |pluto\[.*\]: |charon: |vpnwatch: )', + 'kernel' =3D> '(kernel: (?!DROP_))', + 'ntp' =3D> '(ntpd(?:ate)?\[.*\]: )', 'openvpn' =3D> '(openvpnserver\[.*\]: |.*n2n\[.*\]: )', - 'pakfire' =3D> '(pakfire:) ', - 'wireless' =3D> '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:) ', - 'squid' =3D> '(squid\[.*\]: |squid: )', + 'pakfire' =3D> '(pakfire:)', + 'red' =3D> '(red:|pppd\[.*\]: |chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|ppp= oa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: = isdn.*|ibod\[.*\]|dhcpcd\[.*\]|modem_run\[.*\])', 'snort' =3D> '(snort\[.*\]: )', - 'guardian' =3D> '(guardian\[.*\]: )' + 'squid' =3D> '(squid\[.*\]: |squid: )', + 'ssh' =3D> '(sshd(?:\(.*\))?\[.*\]: )', + 'urlfilter bl' =3D> '(installpackage\[urlfilter\]: )', + 'wireless' =3D> '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:)' ); =20 # Translations for the %sections array. my %trsections =3D ( - 'ipfire' =3D> 'IPFire', - 'red' =3D> 'RED', + 'auth' =3D> "$Lang::tr{'loginlogout'}", + 'clamav' =3D> 'ClamAV', + 'collectd' =3D> 'Collectd', + 'cron' =3D> 'Cron', 'ddns' =3D> "$Lang::tr{'dynamic dns'}", - 'dns' =3D> 'DNS', - 'dma' =3D> 'Mail', 'dhcp' =3D> "$Lang::tr{'dhcp server'}", - 'cron' =3D> 'Cron', - 'collectd' =3D> 'Collectd', - 'clamav' =3D> 'ClamAV', - 'ntp' =3D> 'NTP', - 'ssh' =3D> 'SSH', - 'auth' =3D> "$Lang::tr{'loginlogout'}", - 'kernel' =3D> "$Lang::tr{'kernel'}", + 'dma' =3D> 'Mail', + 'dnsmasq' =3D> 'DNS: Dnsmasq', + 'unbound' =3D> 'DNS: Unbound', + 'guardian' =3D> "$Lang::tr{'guardian'}", + 'ipfire' =3D> 'IPFire', 'ipsec' =3D> 'IPSec', + 'kernel' =3D> "$Lang::tr{'kernel'}", + 'ntp' =3D> 'NTP', 'openvpn' =3D> 'OpenVPN', 'pakfire' =3D> 'Pakfire', - 'wireless' =3D> 'Wireless', - 'squid' =3D> "$Lang::tr{'web proxy'}", + 'red' =3D> 'RED', 'snort' =3D> "$Lang::tr{'intrusion detection'}", - 'guardian' =3D> "$Lang::tr{'guardian'}" + 'squid' =3D> "$Lang::tr{'web proxy'}", + 'ssh' =3D> 'SSH', + 'urlfilter bl' =3D> 'URLFilter Blacklist', + 'wireless' =3D> 'Wireless' ); =20 =20 @@ -212,7 +216,7 @@ while ($gzindex >=3D0 && $loop) { READ:while () { my $line =3D $_; if ($line =3D~ /^${monthstr} ${daystr} ..:..:.. [\w\-]+ ${section}(.*)/) { - # when standart viewing, just keep in memory the correct slice + # when standard viewing, just keep in memory the correct slice # it starts a '$start' and size is $viewport # If export, then keep all lines... if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}){ @@ -223,7 +227,7 @@ while ($gzindex >=3D0 && $loop) { if (@log > $Header::viewsize) { shift (@log); } - #} else { dont do this optimisation, need to count lines ! + #} else { don't do this optimisation, need to count lines ! # $datetime =3D $maxtime; # we have read viewsize lines, stop main= loop # last READ; # exit read file } @@ -288,7 +292,7 @@ print < END ; -foreach $section (keys %sections) { +foreach $section (sort {$trsections{$a} cmp $trsections{$b}} keys %sections)= { print "\t