In AWStats 6.0 (build 1.701), both the documentation in awstats_extra.html and the comments in awstats.model.conf say the following about Extra Section conditions:
# ExtraSectionConditionalX are conditions
# you can use to count or not the hit,
# Use one of the field condition (URL,
# QUERY_STRING, REFERER, UA, HOST),
# and a regex to match after a coma.
# Use "|" for "OR". If you use several
# conditions, they will be combined as "AND".
This explanation as well as the examples provided indicate that in order to combine conditions using "OR", you need to put the pipe character "|" directly between two conditions. Like this:
This does, however, not work. Looking at the source code (lines 1628 ff.), I'd say that the software expects some whitespace around the pipe character. Like this -- which indeed works a lot better:
ExtraSectionCondition1="URL,cond1.html | URL,cond2.html"
With the "OR" mystery solved, I next tried "AND". But for the life of me, I can't figure out how to "use several conditions" (as stated in the documentation) in order to have the software combine them using "AND". In fact, I can't even find the code in awstats.pl that would implement "AND" for Extra Section conditions. The code in lines 6633 ff. only seems to implement "OR".
So my question is: Could it be that this feature is not yet implemented? Or am I missing something? It just doesn't seem to be possible to define an Extra Section that, for example, counts all request for a certain URL coming from a certain HOST ...
The AND support was lost in a code change.
I will try to restore it in a next version.
I will also fix the OR.
Thanks for the confirmation.
There's one more thing I noticed: Since the pipe character (|) is used for OR constructs within regular expressions, it's probably not the best idea to also use it for separating multiple conditions from each others. Or the code that analyzes Extra Section conditions needs to make sure that regular expressions with pipe characters are not split into multiple conditions.
If I'm not mistaken this issue
(AND in ExtraSectionCondition not implemented) seems to be still unfixed in version 6.2
Am I right ?
The or is now "||"
and the AND is still not available
I'm also, a lot interested into the AND implementation in
ExtraSectionCondition. It seems to not be reimplemented, isn't it?
I need count the nb of hits for a specific URL on a specific Virtual Host
stored into an extra1 in the log file. How you will suggest to do it? For me,
it would be an AND operator on the ExtraSectionCondition like:
ExtraSectionCondition1="extra1,^my.virtual.host$ && URL,^\/myrul$"
I can work on the patch if you want but It seems to me complex to combine the
AND and the OR, so I plan to limit the usage only to a succession of OR or of
AND. What do you think?
It is true that there is no AND in extra sections, but I guess that you do not
need to change awstats.pl to do what you want.
Just put the condition about the virtual host in ExtraSectionConditon1 and the
condition about the URL in ExtraSectionFirstColumnValues1 and you are done.
Jean-Luc, InternetOfficer AWStats
First thanks a lot for this quick reply.
Sorry to not have been enough clear but in fact what I want exactly is the nb
of hits per user for a specific VHost on a specific URL. The only solution I
see for that (but I may be wrong) is:
ExtraSectionCondition5="extra1,^my.virtual.host(:80)? && URL,\/+index.psp$"
Or may be there is a solution by doing a plugin?
You may also be surpeise by the (:80)?, but this is because with my LogFormat
= "%extra1:%extra2 %host %other... extra1 should capture the VHost and extra2
the port, but when I display the extran, they all have the value
my.virtual.host:80 even extra3 that should not exist. As I cannot figure out
why, I found this workaround. May be I should open an other topic for that?
Best regards, Christophe.
Sorry that my suggestion above does not work for you.
You might need a special software development or try with a separate config
file for my.virtual.host. I mean that it would generate a complete set of
AWStats reports with %virtualname in LogFormat and with
SiteDomain="my.virtual.host" or SiteDomain="my.virtual.host:80"
and it would include the extra section showing the hosts with the condition on
the URL. Not sure that it meets your requirements though.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.