Site Logging.

IMPORTANT: This logging system is now obsolete; replaced by daily logs sent via email.

We have developed new logging software exclusive to tvScience Hosting.

Customisation.

The format of the logs can be changed. The only field that must be recorded for each hit, is the date. All others can either be:

This option can be set in two ways:

  1. Adding or changing options to your cgi.conf file4, which is in your /example.com/cgi-bin/ directory.
  2. Adding a query string to the <!--#include virtual="/cgi-bin/mail-log.cgi" --> line in your web-pages 2.

Option.

Default Value. Field Affected. Use in
cgi.conf
Use in
Query String.
Range.

Action.

log_max_entries20 -YN5 - 200Entries to log before mailing.
log_periodicn -YN m | w | d | nEnable periodic mailing.
log_page1 Page:YY0 | 1Log page accessed.
log_page_fqdn 0 Page: YY0 | 1Prepend the domain to the pagename.
log_pagename Path to page. Page: NYAny string.The name of the page to be recorded, see log_page.
log_referrerX From: YY0 | 1 | XLog referring URL.
log_ip1 IP: YY0 | 1Log IP address.
log_host1 Host: YY0 | 1 | XLog host (lookup IP: address in DNS).
log_useragent0 With:YY0 | 1 | XLog browser details.
log_domain0 Domain: YY0 | 1Log own domain.
log_check_host1 -YN0 | 1Filter out page reloads.
log_interval600 -YN 10 - 1000Reload interval (seconds), see log_check_host.
log_email0 E-mail: YY0 | 1 | XLog any e-mail address.
log_newline1 -YN0 | 1Add newline at the end of each entry.
log_csv0 AllYN0 | 1Log as CSV data.
log_datefmt%d/%m/%Y%_%T Time: YNValid date format.Format for the date: dd/mm/yyyy hh:mm:ss
log_logstowebmaster@example.com-YNValid e-mail address.Address to send logs.
log_ip_excludenone-YN

Vertical-bar (|) separated list of IP4 addresses.

IP addresses to exclude from logs.
log_subjwww.example.com-YN

Any string.

Start of subject line for e-mails.
log_recent0-YN

0 | 1

Order the log with most recent first.
log_error1ERROR:YN

0 | 1

Place page errors in the log.
log_jump1Destn:YN

0 | 1

Place external jumps in the log.

 Many values can be set in either the query string or in cgi.conf Any value given in the query string will override the value in cgi.conf

To set value(s) in the query string, change your HTML to something like 3:
<!--#include virtual="/cgi-bin/mail-log.cgi?log_page=0&log_host=0"-->

Not the question mark (?). Separate commands with an ampersand (&). Do not include any spaces in the command (i.e. inside the double quotes).

To add values to cgi.conf, include lines like:
# This is a comment line as it starts with a #
log_page = 0
log_host = 0
log_subj = My%_own%_string
log_logsto = logs@example.com

Don't include spaces in strings on the right hand side. Instead use the escape sequence: %_

 Description of Options.

This gives the minimum number of entries in each mailing.

If periodic mailings are enabled then a log will be sent if either of these two options require it. See log_periodic below.

Setting this to zero will disable logging on a site-wide basis, except for pages where the logger's query string overrides this value.

This enables periodic mailings. Options are:

Value.

Action.

n - Never - Disable periodic mailings.
m - Monthly mailings.
w - Weekly mailings.
d - Daily mailings.
 

Setting this option will cause logs to be sent at regular intervals. You should set an interval long enough to guarantee at least one hit!

The log will be mailed on the first hit after the time period has expired. A site with few hits may not receive the log at the expected time.

When the log reaches its maximum permitted size it will be mailed regardless.

If log_max_entries is set then a log will be sent if either of these two options require it. See above.

Should the Page: entry be included in the log? See also log_pagename below.

If log_page=1 then you may use this string as the substitute name for the page.

Do not include spaces.

Should the From: entry be included in the log?

Value.

Action.

0 - Do not log.
1 - Always log, even if empty.
X - Log only if non-blank.

Any X option is forced to a 1 if log_csv is set.

Should the IP: entry be included in the log? This identifies your visitor as far as that is possible (more information).

Should the Host: entry be included in the log?

If enabled the logger will attempt to resolve the IP: into a host-name.

Possible options.

Should the With: entry be included in the log?

Possible options.

Should the Domain: entry be included in the log?

This will be the domain name of your web-site.

Useful if the logged page(s) serve different websites. See also log_logsto below.

Should the logger attempt to filter page reloads? See also log_interval.

Time in seconds which is used to filter out reloads of a page.

If the same log_useragent from the same log_ip load the same log_page within log_interval.
Then it will be considered a re-load and won't be entered in the log.

Some browsers or robots supply an e-mail address to the server. If they do it can be logged.

Possible options.

Should the logger append a blank line to each log entry?

Ignored if log_csv is set.

Should the logs be in CSV format for importation into a database/spreadsheet?

If this is set then any X options will be forced to a '1'. log_recent is forced to a '0'.

The log will be returned with entries like this:

"16/08/2003 10:34:30","http://www.lycos.co.uk/cgi-bin/pursuit?mtemp=main&etemp=error&query=tv+components&cat=brit",212.198.114.35,thelonius.tv-science.co.uk,"Mozilla/4.0 (compatible; MSIE 4.01; Windows 95; Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)","http://www.example.com/index.htm?option=yes&index=22",spamplease@visitor.com,http://www.example.com/

Each hit will be a single line, fields will be enclosed in double quotes where appropriate.

The data can then cut and pasted into another program for further analysis.

A format string for the date field.

Interpreted sequences are:

Value.

Action.

%_

-

a space (a percent sign, followed by an underscore character).

%a

-

locale's abbreviated weekday name (Sun..Sat)

%A

-

locale's full weekday name, variable length (Sunday..Saturday)

%b

-

locale's abbreviated month name (Jan..Dec)

%B

-

locale's full month name, variable length (January..December)

%c

-

locale's date and time (Sat Nov 04 12:02:33 EST 1989)

%d

-

day of month (01..31)

%D

-

date (mm/dd/yy)

%e

-

day of month, blank padded (1..31)

%H

-

hour (00..23)

%I

-

hour (01..12)

%j

-

day of year (001..366)

%k

-

hour (0..23)

%l

-

hour (1..12)

%m

-

month (01..12)

%M

-

minute (00..59)

%p

-

locale's AM or PM

%r

-

time, 12-hour (hh:mm:ss [AP]M)

%s

-

seconds since 00:00:00, Jan 1, 1970

%S

-

second (00..60)

%T

-

time,  24-hour (hh:mm:ss)

%U

-

week number of year with Sunday as first day of week (00..53)

%V

-

week number of year with Monday as first day of week (01..52)

%w

-

day of week (0..6); 0 represents Sunday

%W

-

week number of year with Monday as first day of week (00..53)

%x

-

locale's date representation (mm/dd/yy)

%X

-

locale's time representation (%H:%M:%S)

%y

-

last two digits of year (00..99)

%Y

-

year (1970...)

%Z

-

time zone (e.g. GMT, BST)

Useful examples:
%d/%m/%Y%_%T - yields -

28/02/2002 19:00:01

%e%_%b%_%Y%_%l:%M%_%r - yields - 1 Feb 2003 6:20 AM

Do not use quotes of any kind (" or ' or `) or the dollar sign ($) in your string.

An invalid format may result in an error.

The e-mail address to send logs.

A valid address might be: access.logs_2@tv-science.co.uk

Do not include brackets of any description, spaces, quotes, comments or any other RFC 2822 junk.

An invalid address will result in an error.

If you are logging a page which serves multiple domains then set this variable.

Be sure to request a destination for the default of webmaster@example.com, otherwise logs will be lost.

Exclude these IP addresses from your logs. Use this option to exclude your own page accesses.

Typical entry: 123.456.789.10|111.22.3.4

This is the string which starts the Subject Line of all the loggers' e-mails.

The default is the domain logged.

Do not use quotes of any kind (" or ' or `) or the dollar sign ($) in your string.

Include a space by using the sequence: %_

Should the logger place most recent entries into the log first.

Ignored if logging in CSV format.

Log server errors?

Relevant error messages (broken links etc.) are placed in the log with this option.

Log external jumps?

Jumps to external sites can be logged with /cgi-bin/jumper.pl. Setting this option to 0 disables this feature site-wide. See the documentation on how to use/cgi-bin/jumper.pl.

The logging data for your site is held in the file: /cgi-bin/logfile

To log visitors as they leave your site through an external link, see the External Jump Logger.

Here is further information on the data contained in your logs.

You must give your files an .shtml extension to use this logging feature.

Return to the Top of This Page.

Notes:
1

Not to be confused with the logger's query string.

2

The previous form of <!--#exec cgi="/cgi-bin/mail-log.cgi"--> can no longer be used.

3 These examples can also be found in a text file.
4 Here is an example cgi.conf file. Be sure to preserve the Linux file permissions when editing your copy of this file.
 

 Go to the TV Science Ltd. Homepage.


Legal Information. Last update of this page: . E-Mail: webmaster@tv–science.co.uk