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.


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 / directory.
  2. Adding a query string to the <!--#include virtual="/cgi-bin/mail-log.cgi" --> line in your web-pages 2.


Default Value. Field Affected. Use in
Use in
Query String.


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 e-mail address.Address to send logs.

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

IP addresses to exclude from logs.

Any string.

Start of subject line for e-mails.

0 | 1

Order the log with most recent first.

0 | 1

Place page errors in the log.

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 =

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:



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?



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","",,,"Mozilla/4.0 (compatible; MSIE 4.01; Windows 95; Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)","",,

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:





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



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



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



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



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



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



day of month (01..31)



date (mm/dd/yy)



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



hour (00..23)



hour (01..12)



day of year (001..366)



hour (0..23)



hour (1..12)



month (01..12)



minute (00..59)



locale's AM or PM



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



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



second (00..60)



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



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



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



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



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



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



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



last two digits of year (00..99)



year (1970...)



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:

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, 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|

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/ Setting this option to 0 disables this feature site-wide. See the documentation on how to use/cgi-bin/

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.


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


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–