Don't use .Xo/.Xc. Fix date format.
[netbsd-mini2440.git] / dist / wpa / hostapd / logwatch / hostapd
blob97b24ef6e1b84b1b3d986eeae6ca09c1b096dbad
1 #!/usr/bin/perl -w
3 # Logwatch script for hostapd
5 # Copyright 2005 Henrik Brix Andersen <brix@gentoo.org>
6 # Distributed under the terms of the GNU General Public License v2
7 # Alternatively, this file may be distributed under the terms of the BSD License
9 use strict;
11 my $debug = $ENV{'LOGWATCH_DEBUG'} || 0;
12 my $detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
13 my $debugcounter = 1;
15 my %hostapd;
16 my @unmatched;
18 if ($debug >= 5) {
19 print STDERR "\n\nDEBUG: Inside HOSTAPD Filter\n\n";
22 while (defined(my $line = <STDIN>)) {
23 if ($debug >= 5) {
24 print STDERR "DEBUG($debugcounter): $line";
25 $debugcounter++;
27 chomp($line);
29 if (my ($iface,$mac,$layer,$details) = ($line =~ /(.*?): STA (.*?) (.*?): (.*?)$/i)) {
30 unless ($detail == 10) {
31 # collapse association events
32 $details =~ s/^(associated) .*$/$1/i;
34 $hostapd{$iface}->{$mac}->{$layer}->{$details}++;
35 } else {
36 push @unmatched, "$line\n";
40 if (keys %hostapd) {
41 foreach my $iface (sort keys %hostapd) {
42 print "Interface $iface:\n";
43 foreach my $mac (sort keys %{$hostapd{$iface}}) {
44 print " Client MAC Address $mac:\n";
45 foreach my $layer (sort keys %{$hostapd{$iface}->{$mac}}) {
46 print " $layer:\n";
47 foreach my $details (sort keys %{$hostapd{$iface}->{$mac}->{$layer}}) {
48 print " $details";
49 my $count = $hostapd{$iface}->{$mac}->{$layer}->{$details};
50 if ($count > 1) {
51 print ": " . $count . " Times";
53 print "\n";
60 if ($#unmatched >= 0) {
61 print "\n**Unmatched Entries**\n";
62 print @unmatched;
65 exit(0);