mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 14:25:52 +00:00
##rmor_notify: show last date when using -s # -v
This commit is contained in:
@@ -252,7 +252,6 @@ sub format_message {
|
|||||||
defined($name) and $formatted .= "Name: $name\n";
|
defined($name) and $formatted .= "Name: $name\n";
|
||||||
defined($denied) and $formatted .= "Denied: $denied\n";
|
defined($denied) and $formatted .= "Denied: $denied\n";
|
||||||
defined($family) and defined ($sock_type) and $formatted .= "Family: $family\nSocket type: $sock_type\n";
|
defined($family) and defined ($sock_type) and $formatted .= "Family: $family\nSocket type: $sock_type\n";
|
||||||
#defined($date) and $since > 0 and $formatted .= "Date: ". scalar(localtime($date)) ."\n";
|
|
||||||
$formatted .= "Logfile: $logfile\n";
|
$formatted .= "Logfile: $logfile\n";
|
||||||
|
|
||||||
return $formatted;
|
return $formatted;
|
||||||
@@ -447,6 +446,7 @@ sub do_notify {
|
|||||||
|
|
||||||
sub show_since {
|
sub show_since {
|
||||||
my %msg_hash;
|
my %msg_hash;
|
||||||
|
my %last_date;
|
||||||
my @msg_list;
|
my @msg_list;
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
while(my $msg = <LOGFILE>) {
|
while(my $msg = <LOGFILE>) {
|
||||||
@@ -455,10 +455,11 @@ sub show_since {
|
|||||||
|
|
||||||
my $m = format_message(@attrib);
|
my $m = format_message(@attrib);
|
||||||
$m ne "" or next;
|
$m ne "" or next;
|
||||||
|
my $date = $attrib[6];
|
||||||
if ($opt_v) {
|
if ($opt_v) {
|
||||||
if (exists($msg_hash{$m})) {
|
if (exists($msg_hash{$m})) {
|
||||||
$msg_hash{$m}++;
|
$msg_hash{$m}++;
|
||||||
|
defined($date) and $last_date{$m} = scalar(localtime($date));
|
||||||
} else {
|
} else {
|
||||||
$msg_hash{$m} = 1;
|
$msg_hash{$m} = 1;
|
||||||
push(@msg_list, $m);
|
push(@msg_list, $m);
|
||||||
@@ -470,7 +471,11 @@ sub show_since {
|
|||||||
foreach my $m (@msg_list) {
|
foreach my $m (@msg_list) {
|
||||||
print "$m";
|
print "$m";
|
||||||
if ($msg_hash{$m} gt 1) {
|
if ($msg_hash{$m} gt 1) {
|
||||||
print "($msg_hash{$m} found)\n";
|
print "($msg_hash{$m} found";
|
||||||
|
if (exists($last_date{$m})) {
|
||||||
|
print ", most recent from '$last_date{$m}'";
|
||||||
|
}
|
||||||
|
print ")\n";
|
||||||
}
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user