Skip to content

Commit

Permalink
comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Jan 25, 2025
1 parent b759108 commit 8c10321
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions parse_tomcat_access_logs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,22 @@ =head1 parse_tomcat_access_logs()
if (scalar(@ARGV) ge 1) {
$age = $ARGV[0];
}
my $now="\${dateset_date}";
if (scalar(@ARGV) ge 2) {
$now= $ARGV[1];
}

# just determin current date minus age as a iso string
# this can be used to compare agains date in access logs itself, and skip them if those are earlier
my $after =`date --iso-8601=minutes --date="\${dataset_date} -$age minute"`;

# no need to consider alder files
my $findcommand="find $dir -cmin -$age -name 'tomcat_access.log*'";

# in tomcat access logs the java application's 'context' may appear
# which is for all entries the same (since we do only one application per tomcat)
# so we remove it from the reports
my $context=$ENV{CONTEXT};
if (! defined($context)) {
$context="ROOT";
}
# The path of the request is split, only this many entries are then used for reporting
my $pathlength=$ENV{ACCESS_LOG_PATH_LENGTH};
if (! defined($pathlength)) {
$pathlength=2;
Expand All @@ -62,7 +67,6 @@ =head1 parse_tomcat_access_logs()
my @filelist=<FILELIST>;
close FILELIST;


my %result=();
for my $file (@filelist) {
#print $file;
Expand All @@ -74,7 +78,6 @@ =head1 parse_tomcat_access_logs()
}

while(<$fh>){

my @field=split /\t/;
my $date=$field[0];
if ($date lt $after) {
Expand Down

0 comments on commit 8c10321

Please sign in to comment.