PageViews: 1,362 / 939 / 491 hits / 93 nets since Apr 9 2018
home updates download manual documents feedback search stats

Access Counter and Statitics

Nets Hits Refs Mail info manual SHTML source
Access Counters and Statistics by DeleGate
PageViews: 939 hits / 93 nets

Access counter and statistics by DeleGate

Yutaka Sato @ DeleGate.ORG
May 11, 2006

Basic functionality for access counters and real-time statistics were built-into DeleGate/9.2.0. It is applied not only to access count from clients but also to general counts including Referers, errors, and more, in future. So far, the following counters have been implemented.

  • count for each requested URL on origin/proxy HTTP DeleGate (example)
  • count for each Referer URL on origin/proxy HTTP DeleGate (example)
  • count for each transferred file on origin FTP DeleGate (example)
  • count for each error or rejection in SMTP DeleGate (example)
  • count for each session of FTP, SMTP, NNTP DeleGate (example)
  • count for each packet incoming to DNS DeleGate (example)
This built-in counter is intended to be used to show real-time statistics of DeleGate servers too. It will be convenient to be able to get statistics in real-time and without keeping a large volume of log files.

Basic Usage

Counters are enabled with the COUNTER parameter, as follows in the simplest.


A SSI tag "COUNTER" is introduced to show values in counters. The simplest example is the access counter of the SHTML page including the tag.

    <!--#echo var=COUNTER -->
There are three types of counters based on (client's) IP address; the first one is incremented on every hit, the second one is incremented excluding repetitive hit by the same IP address, and the third one is incremented excluding repetitive hit by one of last ten IP addresses. Each counter is represented with %T, %U, and %V respectively in a format string given by the fmt="formatString" attribute.
    <!--#echo var=COUNTER fmt="%T : %U : %V hits / %N nets (since %tC)" -->
    1362 : 939 : 491 hits / 93 nets (since Apr 9 2018)
Yet another count is "network count" which is represented as "%N" in the format string. It is introduced to be a metrics of the coverage or distribution of (client's) IP addresses on the address space. It is not a counter incremented on each hit, but the number of bits in a bit map of network addresses. In the current implementation, the width of the network mask is 10 bits, therefore the logical maximum number of "%N" is 1024. The map of networks can be shown with "%M" as follows.
    <!--#echo var=COUNTER fmt="%M" -->
  ----X--- -------- ----8X-X -------- -------- -------- -----0-X -------- ----4--- --XX---- -------- -------- -------- -------- -------- ------X- -------- ---X--XX -X------ -------- -X------ -X-X---- -------- 9XXX---- -------- ----XX-- -X-X---- 6XXX---- -------- -------- -------- -------- X---X-X- --71---- -------- -----X-- -------- -------- -----3-- -------- X----XX- -------- -------- -------- -------- -----X-X ------X- --X--2XX -------- -------- X------- -------- --X----- -X------ --X----- -------X -------- -------- -------- -------- -------- -----X-- -------- X------- -X------ -------- ------X- -------- -------- ---X---- ----X--X -------- -X------ ----X--- -------X -X------ -------- -------- ----X--- -----X-- -------- -------- -------- -------- -------- -------- -------X --X----- X------- --XX---- -5-----X ------X- -------- -------- X------- -------- -XX----- --X----X ------X- -------- -------- --X---X- X------- ----X--X ------X- --X----- -X----XX -------- ---X-XX- ------X- ---X---- --------
In the map, each true bit is marked with 'X' while false bit is marked with '-'. The recent ten networks are marked with a digit from '0' to '9'. The recent ten IP addresses can be shown with "%L" as follows.
    <!--#echo var=COUNTER fmt="%L" -->
    LAST[0][233] 0D400065  13.B
    LAST[1][  0] 42F00015  66.D
    LAST[2][  0] 5F500022  95.B
    LAST[3][  0] 4D4000A4  77.B
    LAST[4][  0] 1130003F  17.A
    LAST[5][  0] B4400016 180.B
    LAST[6][  0] 362000A9  54.A
    LAST[7][  0] 42A000BC  66.C
    LAST[8][  0] 05000048   5.A
    LAST[9][  3] 2E0000A3  46.A
This table of recent 10 addresses is managed in the LRU order, that is the entry of the least recentry hit is pushed out from the table.

    <!--#echo var=COUNTER fmt="Hits %T : %mHT/hour, %mdT/day, %mmT/month" -->
    Hits 1362 : 0.2/hour, 5.5/day, 170.7/month

PageViews: 939 hits / 93 nets
[ The source of this SHTML file (882 hits) ]