#Created by Charles Oppenheimer, Recursive Technology LLC December 2004 #Distributed under Perl Artistic License. # Siebel log files, if the logging for the component is turned up high enough, report time for operations # with a Time: (seconds) format. Many types of operations are timed this way, including sql timings, web fetches, business service,etc # In this script, the $executethreshold is compared time for any Siebel operation. # So this script is for finding Siebel operations that take > executethreshold # long running siebel operations will point out siebel performance problem $dir='N:\sblprd1752\siebsrvr\log'; # set directory to be searched - including mapped drives $comp_name = "eCommObj_CTI"; # loosely matches file name $executethreshold = 5; #looks for any operation that took $executethreshold seconds opendir(DIR, "$dir") || die "Could not open $dir $!"; while($name = readdir(DIR)) { ##Put the names in an array, latest files 1st if ($name =~ /$comp_name/) { print "puting name = $name in the array\n"; unshift(@files, $name); } } closedir(DIR); foreach (@files) { my $siebelfile = $_; #print "searching = $siebelfile\n"; open(SEARCHFILE, "<$dir/$siebelfile") || die "Could not open file $matchesboth : $!"; while () { #print "chomping file $dir, line = $line"; # some examples of the strings it would match, from a Siebel log file: # ***** SQL Statement Execute Time: 0.479 seconds ***** # ***** SQL Statement Initial Fetch Time: 0.000 seconds ***** # ObjMgrBusServiceLog InvokeMethod 4 2005-01-20 08:00:02 Business Service 'Web Engine Interface' invoke method 'GetWebImage' Execute Time: 35.155 seconds. if ($_ =~ /Time:\s(\d+\.\d+)/) { if ($1 > $executethreshold) { print "sql fetch time = $1 - file = $siebelfile - $string = $_"; } } } }