use strict;
# enable only the following on debugging purpose
-#use warnings;
-#use CGI::Carp 'fatalsToBrowser';
+use warnings;
+use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
use POSIX();
-#workaround to suppress a warning when a variable is used only once
-my @dummy = ( ${Header::table2colour} );
-undef (@dummy);
-
my %cgiparams=();
my %logsettings=();
my $errormessage = '';
$cgiparams{'SECTION'} = 'ipfire';
my %sections = (
- 'ipfire' => '(ipfire)',
- '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)',
- 'openvpn' => '(openvpnserver)\[.*\]'
+ '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\[.*\]: |charon: |vpnwatch: )',
+ 'openvpn' => '(openvpnserver)\[.*\]: ',
+ 'pakfire' => '(pakfire:) ',
+ 'wireless' => '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:) '
);
# Translations for the %sections array.
'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',
'openvpn' => 'OpenVPN',
- 'snort' => 'Snort'
+ 'pakfire' => 'Pakfire',
+ 'wireless' => 'Wireless'
);
{
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] ) ) {
# calculate end of active week (saturday 23H59)
my @then = ();
@then = localtime(time());
- my $sunday = POSIX::mktime( 0, 0, 0, @then[3], @then[4], @then[5]);
+ my $sunday = POSIX::mktime( 0, 0, 0, $then[3], $then[4], $then[5]);
$sunday += (6-$then[6]) * 86400;
# 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'}};
my $filestr = 0;
my $lastdatetime; # for debug
my $search_for_end = 0;
-
+
while ($gzindex >=0 && $loop) {
# calculate file name
if ($gzindex == 0) {
#&General::log("reading $filestr");
READ:while (<FILE>) {
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...
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;
}
END
;
print "<option value='0'>$Lang::tr{'all'}</option>\n";
-for (my $day = 1; $day <= 31; $day++)
+for (my $day = 1; $day <= 31; $day++)
{
print "\t<option ";
if ($day == $cgiparams{'DAY'}) {
$prev = $start - ${Header::viewsize};
$prev = 0 if ( $prev < 0);
}
-
+
my $next;
if ($start == $lines - ${Header::viewsize}) {
$next = -1;
#print '<tt>';
foreach $_ (@log)
{
- /^... (..) (..:..:..) [\w\-]+ ${section}: (.*)$/;
+ /^... (..) (..:..:..) [\w\-]+ ${section}(.*)$/;
my $day = $1;
$day =~ tr / /0/;
my $time = $cgiparams{'DAY'} ? "$2" : "$day/$2" ;