From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Fischer <matthias.fischer@ipfire.org> To: development@lists.ipfire.org Subject: [PATCH] logs.dat: cosmetical upgrade Date: Sun, 25 Sep 2016 07:56:13 +0200 Message-ID: <20160925055613.1510-1-matthias.fischer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2564619023829534769==" List-Id: <development.lists.ipfire.org> --===============2564619023829534769== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, It has always bothered me that the 'Section' list under "System Logs / Settin= gs" was unsorted and you had to search for the wanted entry. You always get the wrong= one first or look at the wrong place or both... So I took a deep look at http://perlmaven.com/how-to-sort-a-hash-in-perl. What I did: - Sorted 'section' and 'trsection' for better readibility. - Corrected some typos. Not all... - Changed 'section' output to an alphabetically sorted list. - Added an entry for URLFilter Blacklist update. Just cosmetics... ;-) Best, Matthias Signed-off-by: Matthias Fischer <matthias.fischer(a)ipfire.org> --- html/cgi-bin/logs.cgi/log.dat | 64 ++++++++++++++++++++++-------------------= -- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat index 82b6aa0..243b7ab 100644 --- a/html/cgi-bin/logs.cgi/log.dat +++ b/html/cgi-bin/logs.cgi/log.dat @@ -49,50 +49,52 @@ $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\[.*\]: )', + 'dns' =3D> '(dnsmasq\[.*\]: )', + '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', + 'dns' =3D> 'DNS', + '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 +214,7 @@ while ($gzindex >=3D0 && $loop) { READ:while (<FILE>) { 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 +225,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 +290,7 @@ print <<END <select name=3D'SECTION'> END ; -foreach $section (keys %sections) { +foreach $section (sort {$trsections{$a} cmp $trsections{$b}} keys %sections)= { print "\t<option "; if ($section eq $cgiparams{'SECTION'}) { print "selected=3D'selected' "; } --=20 2.9.3 --===============2564619023829534769==--