Trace Netbackup User Activity

  • Uploaded by: Mahek Arora
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Trace Netbackup User Activity as PDF for free.

More details

  • Words: 259
  • Pages: 2
#!/usr/bin/env perl use strict; use warnings; use Data::Dumper qw(Dumper); my $date = `date '+%m%d%y'`; chomp $date; my $input_file = "/usr/openv/netbackup/logs/bpjava-susvc/log.".$date; my $output_file = "/tmp/output.$$"; print "Output file name: $output_file\n"; my @inlist = qw( bppolicynew bpplinfo bppllist bpplclients bppldelete bpplinclude bpplcatdrinfo bpplsched bpplschedrep bpplschedwin bpplvalid bpschedule bpstuadd bpstudel ); my $prefix = "/usr/openv/netbackup/bin/admincmd"; my(%info, %final, %users, %commands, %pids); my($time, $pid, $type, $str); open(LOG, $input_file) or die "Could not open file $input_file: $!\n"; while () { chomp; next if(/^\s*$/); if(! /^\d\d:\d\d:\d\d\.\d\d\d/) { my $str = pop(@{$info{$pid}{$type}}); $str .= "\n$_"; push(@{$info{$pid}{$type}}, $str); next; } my(@tmp) = split(/\s+/, $_, 5); $time = $tmp[0]; $tmp[1] =~ s/\[|\]//g; $pid = $tmp[1]; $tmp[3] =~ s/:$//; $type = $tmp[3]; $str = $tmp[4]; #push(@{$info{$pid}{$type}}, $time.",".$str); push(@{$info{$pid}{$type}}, $str); if($type eq "mkTmpFile" && $str =~ /^temp filename = .*user_ops\/(.*)\/logs.*/) { $users{$pid} = $1; $pids{$pid} = 1; } if($type eq "command_EXEC" && $str =~ /EXEC_RETURN.*buffer = (.*)$/) { my $cmd = $1; my $found = 0; if($cmd =~ /^"$prefix\/(bp.*)" .*$/) { my($c, @t) = split(/\s+/, $1); $c =~ s/"//g; $found = 1 if(grep(/^$c$/, @inlist)); } if($found) { $cmd =~ s/"//g; push(@{$commands{$pid}}, $cmd);

} }

} close(LOG); open(OUT, "> $output_file") or die "Can't open $output_file: $!\n"; foreach $pid(sort keys %pids) { my $user = $users{$pid}; my @cmds = @{$commands{$pid}} if(exists $commands{$pid}); print OUT "USER NAME: $user (PID: $pid)\n"; if(!scalar @cmds) { print OUT "\t*** No Commands Executed ***\n\n"; next; } print OUT "\tCommands Executed:\n"; my $n = 1; foreach my $cmd(@cmds) { print OUT "\t$n. $cmd\n"; $n++; } print OUT "\n"; } close(OUT); system('mailx -s "User tampering Netbackup policies" <email_address> < '.$output_file);

Related Documents

Netbackup
May 2020 8
Trace
June 2020 7
Netbackup Commands
May 2020 3
Trace
May 2020 10
Netbackup Questions
July 2020 2

More Documents from ""