#278 Capture multiple ()'s in ExtraSectionFirstColumnValues

open
None
9
2014-08-28
2003-07-01
Steve Loyola
No

1) Currently, awstats only retains the first matched () in an
ExtraSectionFirstColumnValues regex. It sure would be great if all
the ()'s in the matched regex were retained for
reporting.

2) Also, if the ExtraSectionFirstColumnValues
contains OR'd values (with " | "), then the logic short-circuits (which
I realize is normal, and often desireable behavior). But, it sure would
be great if all elements of the OR were tested and concatenated into
the retained matched string. The lack of short-circuit logic
shouldn't affect anything (except, of course, a small impact on
performance).

I think both of the above suggestions can
be implemented with the following code change (using version 5.6
as a base).

Down in the "# Analyze: Extra" section, change
this:
if ($rowkeytype eq 'URL') {
if ($urlwithnoquery =~
m/$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last;
}
}
elsif ($rowkeytype eq 'QUERY_STRING') {
if
($standalonequery =~ m/$rowkeytypeval/) { $rowkeyval = "$1";
$rowkeyok = 1; last; }
}
elsif ($rowkeytype eq 'REFERER')
{
if ($field[$pos_referer] =~ m/$rowkeytypeval/) {
$rowkeyval = "$1"; $rowkeyok = 1; last; }
}
else {
error("Wrong value of parameter
ExtraSectionFirstColumnValues$extranum"); }

Into
this:
my @matches;
if ($rowkeytype eq 'URL') {

@matches = ($urlwithnoquery =~

m/$rowkeytypeval/);
}
elsif ($rowkeytype eq
'QUERY_STRING') {
@matches = ($standalonequery =~
m/$rowkeytypeval/);
}
elsif ($rowkeytype eq 'REFERER')
{
@matches = ($field[$pos_referer] =~
m/$rowkeytypeval/);
}
else { error("Wrong value of
parameter ExtraSectionFirstColumnValues$extranum"); }
if
(@matches) {
$rowkeyval .= ':' if
$rowkeyok;
$rowkeyval .= join ':',
@matches;
$rowkeyok = 1;
}

The choice of ':' as
a delimiter is open to debate. I tried to pick something you wouldn't
find in a typical URL. I quickly learned that a space didn't work
because that is the column delimiter in the data
files.

Thanks for providing this "Extra" capability to extend
your already great program. I've got 55 Extra sections so far. Sure,
processing takes more than 3 times longer, but that 's nothing
compared to the value of these reports. :-)

Discussion

  • Logged In: YES
    user_id=96898

    Now you can get a AND in conditions. For this, just add a
    second line
    ExtraSectionCondition1="..."