Handle hostnames with upper-case letters
[webmin.git] / itsecur-firewall / authtail.cgi
1 #!/usr/bin/perl
2
3 $trust_unknown_referers = 1;
4 require './itsecur-lib.pl';
5 &can_use_error("logs");
6 &ReadParse();
7 $| = 1;
8 $SIG{'HUP'} = sub { print "got HUP!\n"; };
9 $log = $config{'authlog'} || &get_authlog_file();
10 print "Content-type: text/plain\n\n";
11
12 # Get all the firewall log lines
13 open(LOG, $log);
14 while(<LOG>) {
15         push(@log, $_) if (!&is_log_line($_));
16         shift(@log) if (@log > 20);
17         }
18
19 # Show the last 20, and keep tailing
20 print @log;
21 while(1) {
22         sleep(1);
23         $line = <LOG>;
24         print $line if ($line && !&is_log_line($line));
25         }
26