# Main loop reading log files
foreach my $logfile (@log_files) {
+
&logmsg('DEBUG', "Starting to parse log file: $logfile");
my $curdate = localtime(time);
# Get stats from all pending temporary storage
foreach my $pid (sort {$cur_info{$a}{date} <=> $cur_info{$b}{date}} %cur_info) {
&store_queries($pid);
- if ($extension eq 'tsung') {
+ }
+ if ($extension eq 'tsung') {
+ foreach my $pid (sort { $a <=> $b } keys %tsung_session) {
&store_tsung_session($pid);
}
}
&& ($prefix_vars{'t_query'} =~ /disconnection: session time: ([^\s]+) user=([^\s]+) database=([^\s]+) host=([^\s]+) port=(\d+)/))
{
return if ($disable_session);
+ if ($extension eq 'tsung') {
+ $tsung_session{$prefix_vars{'t_pid'}}{disconnection}{date} = $prefix_vars{'t_date'};
+ }
my $time = $1;
my $usr = $2;
my $db = $3;
print $fh " </transaction>\n";
}
if ($#{$tsung_session{$pid}{dates}} >= 0) {
- my $sec = $tsung_session{$pid}{dates}[-1] - $cur_info{$pid}{date};
+ my $sec = $tsung_session{$pid}{disconnection}{date} - $tsung_session{$pid}{dates}[-1];
print $fh " <thinktime value=\"$sec\" random=\"true\"></thinktime>\n" if ($sec > 0);
}
if (exists $tsung_session{$pid}{connection}{database}) {