3 # logwatch filter script for bacula log files
6 # D. Scott Barninger and Karl Cunningham
8 # Copyright 2005-2006 Free Software Foundation Europe e.V.
9 # licensed under GPL-v2
12 use POSIX qw(strftime);
14 my (@JobName,$JobStatus,$ThisName,$ThisStatus,$ThisDate);
15 my ($Job,$JobId,$JobDate,$Debug,$DebugCounter,%data);
18 $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
21 print STDERR "\n\nDEBUG: Inside Bacula Filter \n\n";
28 print STDERR "DEBUG($DebugCounter): $_\n";
32 # Test the line for a new entry, which is a jobid record
33 if (/^\s*JobId:\s+(\d+)/) {
38 (/^\s*Job:\s*(.*)/) and $Job = $1;
39 (/^\s*Termination:\s*(.*)/) and $JobStatus = $1;
40 (/^\s*Job:.*(\d{4}-\d{2}-\d{2})/) and $JobDate = $1;
42 if ($JobId and $Job and $JobStatus and $JobDate) {
45 "JobStatus" => $JobStatus,
46 "JobDate" => $JobDate,
48 $JobId = $Job = $JobStatus = $JobDate = "";
52 # if we have data print it out, otherwise do nothing
53 if (scalar(keys(%data))) {
54 print "\nJobs Run:\n";
55 foreach my $Id (sort {$a<=>$b} (keys(%data))) {
56 $ThisName = $data{$Id}{Job};
57 $ThisStatus = $data{$Id}{JobStatus};
58 $ThisDate = $data{$Id}{JobDate};
60 $ThisStatus =~ s/\s//g;
61 print "$ThisDate $Id $ThisName\n $ThisStatus\n\n";