Log2Stats Documentation

Parsing filters

Parsing filters allows you to modify log file entries before they will be processed and saved into the database:

Log2Stats workspace settings - Parsing filters

Parsing filters can be used to accomplish the following tasks:

  • Setup advertizing
  • Append query string variables to resource name
  • Modify resource type and logging strategy
  • Modify requested resource name and query string
  • Change referring domain or referrer string
  • Change user agent and authenticated user fields
  • Change the name of requested host or server

To add new parsing filter use button. Parsing filter editor will appear:

Web log parsing filter in Log2Stats

Each parsing filter contains conditions and actions. Conditions are tested against log file line and determine whether filter's actions will be executed.

Parsing filters will be applied to each log file line starting from top to bottom one by one. However if a filter matches a log line and "Continue with other filters" option is turned off then further filters will not be tested.

The following fields can be used as a condition target:

Condition targetDescription
IP AddressIP address of the visitor. You can use network mask in CIDR notation here.
StatusHTTP status code like 403 or 500. See full list here.
Host nameDomain name of your web site. You will not be able to filter by this field unless your log files contains data for more than one domain.
ReferrerReferring page. I.e. http://www.this.web/site/links/to/your.resource
Resource nameRequested resource name not including query string.
Query stringQuery string used in request or '-' if it is empty.
User agentVisitor's user agent string.
MethodHTTP method used in request: GET, POST, HEAD etc. Full list can be found here.
Authenticated userUsername of authenticated users.
Server nameThe name of the server which processed the request.
Parsing filter actions

When all filter conditions are satisfied, the actions are performed. Action is used to change parameters of log file line. You can change resource name, query string, referrer and other parameters. Also you can set resource type and logging strategy for this request. Read more about resource types and logging strategies in the File types - Documentation

Log2Stats don't store query strings along with resource names to make parsing and reporting faster. If you have dynamic pages which generates different content according to supplied query string parameters, then you should use parsing filters to add these parameters to query string manually. I.e. if your pages looks like http://www.yoursite.com/content.php?page=Home then you want to add the following parsing filter:

Resource matches ^/content.php
Add the following variables from query string to resource name page

To add several variables specify all of them delimited with ','. It is also possible to add the whole query string to resource name. Use '*' in the variable field to do this.

Advertizing setup

Parsing filters allows you to assign two additional parameters to visit: advertizing campaign and advertizing parameter. Later you can use instant filters to filter statistics by these two parameters.

Advertizing campaign is a traffic source. I.e. you can exchange links with a 3rd party web site and use referring page as a condition to mark visitors who came from that web site. Or you can send e-mails to your subscribers and put a special link to your web site to track visits from e-mails. In this case you want to use resource name and/or query string as a condition.

Advertizing parameter is an additional parameter you can set for each advertizing. It can be a variable in the query string or referring page query string. Also it can be a static value.

Additional visitor information

Parsing filters allows you to retrieve additional user information like cookie based visitor ID, screen resolution and colors, java script version and so on. To use this feature you will need to insert a small java script into your pages and use "Get additional information from query string" action.
To learn more about setting this up please see the tutorial:  Setting up additional information about your visitors

Parsing filter samples

The following filter will set resource type to undefined for all "Not found" resources and set logging strategy to "Non-visit" for them:

Status equals 404
Resource name not equals /favicon.ico
Set resource type to Other
Set logging strategy to Non-visit

Filter below will add phpBB's forum id and thread id to resource name so you will be able to track your forum usage:

Resource name matches ^/forum/(viewforum|viewtopic)\.php
Add the following variables from query string to resource name f,t
Set resource type to Page
Set logging strategy to Visit

Next parsing filter allows you to track your e-mail advertizings. Assuming your e-mails links to your web site using the following ulrs: http://www.example.com/somepage.php?from=email&id=8

Query string matches (^|&)from=email
Advertizing campaign E-mail
Take advertizing campaign parameter from the following query string variable id