From: Matthias Fischer <matthias.fischer@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] log.dat v3: cosmetical upgrade
Date: Sun, 23 Oct 2016 00:17:38 +0200 [thread overview]
Message-ID: <20161022221738.3306-1-matthias.fischer@ipfire.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 5893 bytes --]
Please note - this commit is an alternative to:
http://git.ipfire.org/?p=people/mfischer/ipfire-2.x.git;a=commit;h=972a3758e33e5e376d3f413bb81fd3f2f4e58c68
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 <matthias.fischer(a)ipfire.org>
---
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'} = '';
$cgiparams{'SECTION'} = 'ipfire';
my %sections = (
- 'ipfire' => '(ipfire: )',
- 'red' => '(red:|pppd\[.*\]: |chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|pppoa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: isdn.*|ibod\[.*\]|dhcpcd\[.*\]|modem_run\[.*\])',
- 'ddns' => '(ddns\[\d+\]:)',
- 'dns' => '(dnsmasq\[.*\]: |unbound\[.*\]: )',
- 'dma' => '(dma\[.*\]: )',
- 'dhcp' => '(dhcpd: )',
+ 'auth' => '(\w+\(pam_unix\)\[.*\]: )',
'clamav' => '(clamd\[.*\]: |freshclam\[.*\]: )',
'collectd' => '(collectd\[.*\]: )',
'cron' => '(fcron\[.*\]: )',
- 'ntp' => '(ntpd(?:ate)?\[.*\]: )',
- 'ssh' => '(sshd(?:\(.*\))?\[.*\]: )',
- 'auth' => '(\w+\(pam_unix\)\[.*\]: )',
- 'kernel' => '(kernel: (?!DROP_))',
+ 'ddns' => '(ddns\[\d+\]:)',
+ 'dhcp' => '(dhcpd: )',
+ 'dma' => '(dma\[.*\]: )',
+ 'dnsmasq' => '(dnsmasq\[.*\]: )',
+ 'unbound' => '(unbound: \[.*:.*\])(.*:.*$)',
+ 'guardian' => '(guardian\[.*\]: )',
+ 'ipfire' => '(ipfire: )',
'ipsec' => '(ipsec_[\w_]+: |pluto\[.*\]: |charon: |vpnwatch: )',
+ 'kernel' => '(kernel: (?!DROP_))',
+ 'ntp' => '(ntpd(?:ate)?\[.*\]: )',
'openvpn' => '(openvpnserver\[.*\]: |.*n2n\[.*\]: )',
- 'pakfire' => '(pakfire:) ',
- 'wireless' => '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:) ',
- 'squid' => '(squid\[.*\]: |squid: )',
+ 'pakfire' => '(pakfire:)',
+ 'red' => '(red:|pppd\[.*\]: |chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|pppoa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: isdn.*|ibod\[.*\]|dhcpcd\[.*\]|modem_run\[.*\])',
'snort' => '(snort\[.*\]: )',
- 'guardian' => '(guardian\[.*\]: )'
+ 'squid' => '(squid\[.*\]: |squid: )',
+ 'ssh' => '(sshd(?:\(.*\))?\[.*\]: )',
+ 'urlfilter bl' => '(installpackage\[urlfilter\]: )',
+ 'wireless' => '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:)'
);
# Translations for the %sections array.
my %trsections = (
- 'ipfire' => 'IPFire',
- 'red' => 'RED',
+ 'auth' => "$Lang::tr{'loginlogout'}",
+ 'clamav' => 'ClamAV',
+ 'collectd' => 'Collectd',
+ 'cron' => 'Cron',
'ddns' => "$Lang::tr{'dynamic dns'}",
- 'dns' => 'DNS',
- 'dma' => 'Mail',
'dhcp' => "$Lang::tr{'dhcp server'}",
- 'cron' => 'Cron',
- 'collectd' => 'Collectd',
- 'clamav' => 'ClamAV',
- 'ntp' => 'NTP',
- 'ssh' => 'SSH',
- 'auth' => "$Lang::tr{'loginlogout'}",
- 'kernel' => "$Lang::tr{'kernel'}",
+ 'dma' => 'Mail',
+ 'dnsmasq' => 'DNS: Dnsmasq',
+ 'unbound' => 'DNS: Unbound',
+ 'guardian' => "$Lang::tr{'guardian'}",
+ 'ipfire' => 'IPFire',
'ipsec' => 'IPSec',
+ 'kernel' => "$Lang::tr{'kernel'}",
+ 'ntp' => 'NTP',
'openvpn' => 'OpenVPN',
'pakfire' => 'Pakfire',
- 'wireless' => 'Wireless',
- 'squid' => "$Lang::tr{'web proxy'}",
+ 'red' => 'RED',
'snort' => "$Lang::tr{'intrusion detection'}",
- 'guardian' => "$Lang::tr{'guardian'}"
+ 'squid' => "$Lang::tr{'web proxy'}",
+ 'ssh' => 'SSH',
+ 'urlfilter bl' => 'URLFilter Blacklist',
+ 'wireless' => 'Wireless'
);
@@ -212,7 +216,7 @@ while ($gzindex >=0 && $loop) {
READ:while (<FILE>) {
my $line = $_;
if ($line =~ /^${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 >=0 && $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 = $maxtime; # we have read viewsize lines, stop main loop
# last READ; # exit read file
}
@@ -288,7 +292,7 @@ print <<END
<select name='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='selected' "; }
@@ -369,8 +373,8 @@ print <<END
<table width='100%' class='tbl'>
<tr>
<th width='10%' align='center' class='boldbase'><b>$Lang::tr{'time'}</b></th>
- <th width='10%' align='center' class='boldbase'><b>$Lang::tr{'section'}</b></th>
- <th width='80%'> </th>
+ <th width='15%' align='center' class='boldbase'><b>$Lang::tr{'section'}</b></th>
+ <th width='75%'> </th>
</tr>
END
;
--
2.10.1
reply other threads:[~2016-10-22 22:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161022221738.3306-1-matthias.fischer@ipfire.org \
--to=matthias.fischer@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox