|
|
@ -82,4 +82,29 @@ while (<STDIN>){ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result->{distinct} = { |
|
|
|
|
|
|
|
users => scalar keys %{$result->{users}}, |
|
|
|
|
|
|
|
machines => scalar keys %{$result->{machines}}, |
|
|
|
|
|
|
|
ip => scalar keys %{$result->{ip}}, |
|
|
|
|
|
|
|
files => scalar keys %{$result->{files}}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result->{top10} = { |
|
|
|
|
|
|
|
users => get_top($result->{users}), |
|
|
|
|
|
|
|
machines => get_top($result->{machines}), |
|
|
|
|
|
|
|
ip => get_top($result->{ip}), |
|
|
|
|
|
|
|
files => get_top($result->{files}), |
|
|
|
|
|
|
|
operations => get_top($result->{operations}) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
print to_json($result, { pretty => 1}); |
|
|
|
print to_json($result, { pretty => 1}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub get_top { |
|
|
|
|
|
|
|
my $hash = shift; |
|
|
|
|
|
|
|
my $res = []; |
|
|
|
|
|
|
|
foreach my $item (sort { $hash->{$b} <=> $hash->{$a} } keys %{$hash}){ |
|
|
|
|
|
|
|
push @{$res}, $item . " ($hash->{$item})"; |
|
|
|
|
|
|
|
last if (scalar(@{$res}) ge 010); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $res; |
|
|
|
|
|
|
|
} |
|
|
|