home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / gostats.zip / gostats.txt < prev   
Text File  |  1999-03-12  |  17KB  |  540 lines

  1. GoStats version 1
  2.  
  3. Written by:
  4.   Byte Of Software Systems Inc.
  5.   #75 - 20465 Douglas Crescent
  6.   Langley, British Columbia
  7.   V3A 4B6
  8.  
  9.   http://www.bossi.com
  10.   gostats@bossi.com
  11.  
  12. All rights reserved.
  13.  
  14. You may copy and distribute this version of Gostats to your hearts content,
  15. as long as the original files are included, along with this document.
  16.  
  17. Suggestions for changes to GoStats are welcome. Be aware that not all ideas
  18. will be implemented.
  19.  
  20. GoStats is shareware, not crippleware. If you feel that it is useful, please
  21. send a nice amount to the above address. All donations are accepted :-))
  22. If you want a reply (and possibly an upgrade version), include your eMail
  23. address.
  24.  
  25.  
  26. Purpose:
  27. ~~~~~~~~
  28.   GoStats was written to allow GoServe Web Server administrators and users to
  29. see their usage statistics.
  30.  
  31.   GoStats reads through the GoServe audit file (normally GOAUDIT.80) and
  32. creates an HTML page which contains the usage stats. By reading modifying the
  33. GOFILTER.80 file that GoServer uses, it is possible to allow users to extract
  34. their own statistics online, based on the IP address that they are using.
  35.  
  36. Note that this is the most usefull on INTRANET systems, where users tend to
  37. have the same IP address all the time, either by using static IP, or DHCP.
  38.  
  39. GoStats tries very hard to be YEAR2000 compliant :-))
  40.  
  41.  
  42. Installation
  43. ~~~~~~~~~~~~
  44. You have. When you de-compressed the ZIP file you completed the installation.
  45. If you want GoStats in a different location, simply move it there. Note that
  46. the GOSTATS.INI file MUST be in the same directory as GoStats.EXE.
  47.  
  48.  
  49. Files Included
  50. ~~~~~~~~~~~~~~
  51. GoStats.txt   This file
  52. GoStats.exe   The program file
  53. GoStats.ini   A sample ini file, commented
  54. GoFilter.80   A sample GoServer Filter file with the required changes
  55. GoStats.htm   A sample page to ask for a stats generation
  56.  
  57.  
  58. Syntax:
  59. ~~~~~~~
  60.   GoStats ACTION <ip> <html_file> DATES
  61.     ACTION  - required word:
  62.               - parse          : no screen o/p   - usual mode
  63.               - verbose        : some screen o/p - testing aid
  64.               - debug:filename : Lots of o/p to filename, some to screen
  65.     ip       - IP address to find
  66.     html_out - file name to write the stats to (HTML format)
  67.     DATES    - date limitation control:
  68.               - all       : stats for all dates (never use this online!)
  69.               - today     : stats for current date only
  70.               - this-month: stats for current month
  71.               - this-year : stats for current year
  72.               - last-month: stats for previous month
  73.               - last-year : stats for previous year
  74.  
  75. GoStats parse 240.34.65.12 c:\st\$_123.html last-month
  76.  
  77.  
  78. Command Line Options:
  79. ~~~~~~~~~~~~~~~~~~~~~
  80. These are the command line options in detail.
  81.  
  82. ACTION
  83.  This determines how much information GoStats will send to the screen while
  84.  it is running. The options that you would use during normal running is PARSE.
  85.  
  86.    PARSE
  87.    Parse will not produce any screen output except where a syntax error is
  88.    detected during the INI parsing. You should test your INI file berfore you
  89.    put it online.
  90.  
  91.    VERBOSE
  92.    Displays on the screen various messages while it is parsing the GoServer
  93.    Audit file.
  94.  
  95.    DEBUG:filename
  96.    This is the action that produces the most output. Every line that GoStats
  97.    reads is printed to the file, every internal ordering is printed, and
  98.    other internal messages are printed. In most cases, the file will be at
  99.    least twice as large as the original audit file. Only use this option if
  100.    you are having problems using GoStats.
  101.  
  102.  IP
  103.  This is the IP address that GoStats will produce a report for. You can also
  104.  specify ALL as an IP address, in which case you will get stats for all the
  105.  IP address. DO NOT use ALL online! The runtime is quite lengthy.
  106.  
  107.  HTML_OUT
  108.  The name of a file that GoStats uses to create the Web page. See the GOFILTER
  109.  section of this document for a suggested name.
  110.  
  111.  DATES
  112.  GoStats will limit the stats to the date range given.
  113.  
  114.    ALL
  115.    All dates. This takes a long time to generate and should not normally be
  116.    presented for online use.
  117.  
  118.    TODAY
  119.    The stats for today.
  120.  
  121.    THIS-MONTH, THIS-YEAR
  122.    The current month or year.
  123.  
  124.    LAST-MONTH, LAST-YEAR
  125.    The previous month or year.
  126.  
  127.  
  128.  The longest generation times happen when you use the command line:
  129.    gostats debug:c:\gostats\run.log all c:\gostats\stats.html all
  130.  
  131.  Run times in the minutes will result.
  132.  Use caution when using the ALL keywords!!
  133.  
  134. GoStats.INI
  135. ~~~~~~~~~~~
  136.    You can greatly alter the functioning of GoStats using this initialization
  137.  file. This file MUST exist, and it MUST be in the same directory as
  138.  GoStats.EXE
  139.  
  140.  The following ini file commands are presented in no particular order, and
  141.  they can appear in the ini file in any order, except as indicated. The sample
  142.  INI file has any comment lines. You can decrease the time required by
  143.  GoStats to read the file by removing all the comment lines. This will have
  144.  the greatest effect on slwo machines.
  145.  
  146.  Basic INI File Syntax
  147.    The first non-blank, non-comment line in the INI file MUST BE:
  148.      GoStats INI File 1
  149.  
  150.    As new verswino of GoSTats are created, and if they have added INI file
  151.    commands, then this line will change, however new version will be able to
  152.    read older version, ar at least be able to convert them.
  153.  
  154.    Blank lines are ignored. Any line beginning with the character * is also
  155.    ignored, which allows you to comment your ini files.
  156.  
  157.    All commands can be either upper or lower case. IN the sample INI file
  158.    manditory keywords are shown in UPPER case. Optional keywords are shown
  159.    in lower case.
  160.  
  161.    GoStats will change any text that is not within double quotes to upper
  162.    case:
  163.      keyword = text
  164.      keyword2 = "text"
  165.    These resolve to:
  166.      KEYWORD=TEXT
  167.      KEYWORD2=text
  168.  
  169.    You can place double quotes by using two adjacent double quotes:
  170.      keyword="The name I found, ""Bob"", starts with the letter ""B""."
  171.    This resolves to:
  172.      KEYWORD=The name I found, "Bob", starts with the letter "B".
  173.  
  174.    Some keywords are shown as two words. GoStats will ignore all spaces in a
  175.    key word. The following are equivalent:
  176.      Key Word=
  177.      keyword =
  178.      k e y w o r d =
  179.  
  180.   The maximum line length in the INI file is 1024 characters. If you need more,
  181.   them split your line. This should only be required when you are setting
  182.   Web page text and formatting. Web browsers ignore line splits.
  183.  
  184.   When the key words require a file name or path, GoStats will convert
  185.   back slashes "\" to forward slashes "/".
  186.  
  187. KeyWords
  188.  
  189.  The following keywords are presented in a readable manner, but in no
  190.  particular order. Feel free to group them as you want. The presentaton here
  191.  and in the INI file makes sense to me :-))
  192.  
  193. BEEP RUN = YES | NO
  194.  
  195.    optional
  196.  
  197.    Every time that GoStats encounters this line in the INI file, it will
  198.    beep. This can be used to indicate that someone wnated a stats page. The
  199.    default is NO.
  200.  
  201.      BEEP RUN = YES
  202.  
  203.  
  204. BEEP ERROR = YES | NO
  205.  
  206.    optional
  207.  
  208.    GoStats runs quietly, that is it produces no screen output. If an error
  209.    is encountered after the INI file has been read, the error is written to
  210.    the Web page, and sent to the user. There is no indication at the server]
  211.    that an erro occurred. You can have GoStats beep when this type of error
  212.    occurs. The default is NO.
  213.  
  214.  
  215. PERSONALITY = GOSERVE2
  216.  
  217.    REQUIRED
  218.  
  219.    The define the type of audit log that GoStats will read. Note that as of
  220.    this release, GoStats can only read GoServer version 2.x audit files. So
  221.    the only setting allowed is GOSERVE2.
  222.  
  223.      PERSONALITY = GOSERVE2
  224.  
  225.  
  226. AUDIT FILE = <file-name>
  227.  
  228.    REQUIRED
  229.  
  230.    The name of the audit log file. This is probably in the same directory as
  231.    the GoServer application. GoStats does not allow multiple audit files in
  232.    this release.
  233.  
  234.      AUDIT FILE = c:\GoServer\goaudit.80
  235.  
  236.  
  237. BASE FILE  = <file-name>
  238.  
  239.    REQUIRED
  240.  
  241.    The name of the base file. This is the file that is returned to the user
  242.    when they do not specify a file. It is usually INDEX.HTML, but you may
  243.    have given it a different anme.
  244.  
  245.      BASE FILE  = \index.html
  246.  
  247.  
  248. HTML PATH  = <path>
  249.  
  250.    REQUIRED
  251.  
  252.    The path that is used to get to the Web pages on the server. Note that this
  253.    is ONLY at the local level. GoStats will remove this path from the stats
  254.    page. After all the user does not need to know the local path, and it
  255.    could be a security problem. You must use a trailing slash.
  256.  
  257.      HTML PATH = d:\intranet\
  258.  
  259.  
  260. TEMP PATH  = <path>
  261.  
  262.    REQUIRED
  263.  
  264.    The path that is used by GoServer for temporary files. This might be
  265.    different from the BASE PATH if the base path points to a read only
  266.    drive, such as a CD-ROM. The temp path is used during Special Start and
  267.    Special File processing.
  268.  
  269.      TEMP PATH = c:\temp\
  270.  
  271.  
  272. SHOW = <type> , YES | NO
  273.  
  274.    optional
  275.  
  276.    This series of setting determine what stats will be generated. The default
  277.    for all of the settings is NO. The stats will be shown in the order in which
  278.    you place them into the INI file. Each stat will be shown once, even if you
  279.    have it twice in the INI file.
  280.  
  281.    The generation stat will ALWAYS be shown at the end.
  282.  
  283.      show = ip list    , yes
  284.      show = connection , yes
  285.      show = file list  , yes
  286.      show = hours      , yes
  287.      show = date list  , yes
  288.      show = generation , yes
  289.  
  290.  CONNECTION
  291.  
  292.    The connections are shown in chronological order. Please note: If you use
  293.    the IP address ALL, then this is automatically set to NO.
  294.  
  295.  FILE LIST
  296.  
  297.    The file list is shown in alphabetical order.
  298.  
  299.  HOURS
  300.  
  301.    The number of connections for each hour.
  302.  
  303.  DATE LIST
  304.  
  305.    The number of connections for each date.
  306.  
  307.  IP LIST
  308.  
  309.    IP address stats, such as number of connections, max trasnfer rate, ...
  310.  
  311.  GENERATION
  312.  
  313.    The stats for the generation of the stats. These are always written into
  314.    the Web page as comments.
  315.  
  316.  
  317. BODY = <settings>
  318.  
  319.    optional
  320.  
  321.    You can place any <body> commands into the generated Web page.
  322.  
  323.      body = "link=""#3333FF"" vlink=""#663366"" alink=""#FF0000"""
  324.  
  325.  
  326. COLOR TABLE = <text>, <background>
  327.  
  328.    REQUIRED
  329.  
  330.    The colours to use for the normal table text and background. At this time,
  331.    images for the background are not supported. Use the standard Web page
  332.    colour scheme.
  333.  
  334.      COLOR TABLE = #000000, #CCFFFF
  335.  
  336.  
  337. COLOR TITLE = <text>, <background>
  338.  
  339.    REQUIRED
  340.  
  341.    The colours to use for the table titles text and background. At this time,
  342.    images for the background are not supported. Use the standard Web page
  343.    colour scheme.
  344.  
  345.      COLOR TITLE = #FFFFCC, #003300
  346.  
  347.  
  348. BROKEN CONNECTION = <text colour>, <background colour>, <message>
  349.  
  350.    REQUIRED
  351.  
  352.    The colours and text to use to indicate that the user started a connection
  353.    but it was broken. This can occur when a user starts to download a file,
  354.    such as a ZIP file, but cancels the download. Use the standard Web page
  355.    colour scheme.
  356.  
  357.      BROKEN CONNECTION = #FFFFFF, #FF0000, "** Broken Connection **"
  358.  
  359.  
  360. SPECIAL START = <character>, <text colour>, <background colour>, <message>
  361.  
  362.    REQUIRED
  363.  
  364.    In the normal GOFILTER.80 file that GoServer uses, is the definition for a
  365.    temporary file. By default all the temporary files start with the
  366.    character "$". However you may have changed this character. GoStats will
  367.    replace the actual file name used by the temporary file, and replace it
  368.    with the message that you specify.
  369.  
  370.    So, using the example below and the TEMP PATH example above, if a file was
  371.    returned to the user named "c:/temp/$123.80", the statistics file name
  372.    would be: ** Request for Unknown File **
  373.  
  374.      SPECIAL START = $ , #000000, #FFFF00, "** Request for Unknown File **"
  375.  
  376.  
  377. SPECIAL FILE = <character>, <text colour>, <background colour>, <message>
  378.  
  379.    optional - multiple
  380.  
  381.    Given that GoStats processes temporary files differently, and that the
  382.    statistics file is temporary, you do not want to "scare" the user into
  383.    thinking that they are requesting "funny files" when they are doing
  384.    stats requests. Since you may also have other special temporary files that
  385.    your GOFILTER creates, GoStats allows for an unlimited number of special
  386.    file types. The character used here must immediately follow the SPECIAL START
  387.    character given. I have used the underscore to indicate stats files, so:
  388.  
  389.      special file  = _ , #FFFFFF, #999900, "** Statistics Request **"
  390.  
  391.    If the file returned was named "c:/temp/$_12.80", the statistics file name
  392.    would be: ** Statistics Request **
  393.  
  394.  
  395. PAGE TITLE  = <message>
  396.  
  397.    REQUIRED
  398.  
  399.    This is the message that will be placed into the Web page title. This is
  400.    shown in the Web Browser title bar, and is also the text used when
  401.    bookmarks are added.
  402.  
  403.    You can place the user's IP addres into the title, by placing a %s into the
  404.    title. Note that you can only use one %s, and that no other character may
  405.    follow the %. If you want the actual character % to be shown, then use
  406.    two of them, %%.
  407.  
  408.      PAGE TITLE  = "Web Server Stats for %s - Generated"
  409.  
  410.  
  411. PAGE TOP = <message>
  412.  
  413.    REQUIRED - multiple
  414.  
  415.    This is the text that will be written to the Web page just before the stats
  416.    categories are generated. You can have as many of these as you require.
  417.    You cannot use a percent sign followed by any other character other than
  418.    another percent sign, %%.
  419.  
  420.      PAGE TOP = "<CENTER><H2>My Web Server</H2></CENTER>"
  421.      page top = "<B>This page is generated.</B> If you have problems please"
  422.      page top = "contact <A HREF=""mail:webmaster@domain.com"">Webmaster</A>"
  423.      page top = "<br>"
  424.      page top = "<b>Please note. All dates and times are based on Greenwich"
  425.      page top = "Mean Time (GMT)</b><br>"
  426.      page top = "<i>On the West Coast of North America this is -8 hours,"
  427.      page top = "so 16:00:00 GMT is 08:00:00 Pacific</i>"
  428.  
  429.  
  430. PAGE BOTTOM = <message>
  431.  
  432.    REQUIRED - multiple
  433.  
  434.    This is the text that is placed at the very bottom of the Web page. You
  435.    should include any copywright and date messages here.
  436.  
  437.      PAGE BOTTOM = "<CENTER><I>Copyrighted: My Organization 1999</I></CENTER>"
  438.  
  439.  
  440. PAGE ERROR = <message>
  441.  
  442.    REQUIRED - multiple
  443.  
  444.    This is the message that is displayed in the case of an error while the Web
  445.    page was being generated. You should include information on how to reach
  446.    the Webmaster.
  447.  
  448.    In most cases an error will occur when the user tries to use there own date
  449.    syntax.
  450.  
  451.    PAGE ERROR = "<CENTER><B>An error has occurred."
  452.    page error = "Contact the Webmaster.</B></CENTER><BR>"
  453.    page error = "<CENTER><B>Or print this page and FAX it"
  454.    page error = "to 555-1212.</B><CENTER>"
  455.  
  456.  
  457. GOAUDIT FILE
  458. ~~~~~~~~~~~~
  459.  
  460. GoStats does not report for every possible GOAUDIT action condition. Four
  461. actions are supported:
  462.  
  463. D - Date
  464. A - Start of Connection
  465. S - Request for file
  466. C - Completion of request
  467.  
  468. All other actions are ignored.
  469.  
  470. Please note that GoServer must be set to use GMT, so that the date line reads:
  471.   153055 D 0 19980828 GMT ----- GoServe 2.52 -----
  472.  
  473. The "GMT" is used to verify a date change.
  474.  
  475.  
  476. GOFILTER Changes
  477. ~~~~~~~~~~~~~~~~
  478.  
  479. To allow the online use of GoStats, you must make modification to the GOFILTER
  480. file, otherwise GoServer will not be able handle a stats request.
  481.  
  482. ** WARNING **
  483. GoServer will halt on any GOFILTER error. Always test your changes on an
  484. offline machine.
  485. ** WARNING **
  486.  
  487. Locate the section of REXX code that starts with:
  488. --------------
  489.    tempfile=dir'$'transaction'.'port                      /* Often used */
  490. --------------
  491.  
  492. Place the following line after it. Note that there is an underscore after
  493. the dollar sign. If you are using a character other than the dollar sign for
  494. the "tempfile", then you must use the same character here.
  495. --------------
  496.    statfile=dir'$_'transaction'.'port                     /* stats file name */
  497. --------------
  498.  
  499. Now locate the REXX code:
  500. --------------
  501.    /* Allow some special 'control' requests.  For these, the verb is */
  502.    /* ignored (though would usually be GET) */
  503.    if left(sel,1)='!' then do
  504. --------------
  505.  
  506. And place the following code after the last line. Please note that you need to
  507. change the program and file locations to match your system.
  508.  
  509. --------------
  510.     if left(sel,6)='!stats' then do      /* * stats * */
  511.       'extract clientaddr'            /* get the IP address */
  512.       st_type = substr(sel,8,50)      /* could be !stats-this-month */
  513.  
  514.       address cmd
  515.       'call c:\GoStats\GoStats.exe parse 'clientaddr' 'statfile' 'st_type
  516.       return 'FILE ERASE TYPE text/html NAME ' statfile
  517.     end
  518. --------------
  519.  
  520. And that's it. Now when a stats request is received by GoServer, a stats page
  521. will be created and sent back. Use and change the sample stats request page.
  522.  
  523.  
  524. Disclaimer
  525. ~~~~~~~~~~
  526.  
  527. GoStats is presented as-is. Any errors, problems, server crashes, and/or
  528. network impact that GoStats may or may not cause is the responsibility of
  529. the user.
  530.  
  531. Always test your INI file OFFLINE.
  532.  
  533. While reasonable care has been taken in the writing and testing of GoStats,
  534. it is possible that a fatal error can occur.
  535.  
  536. Always test your INI file OFFLINE.
  537. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  538.  
  539. 'nuf said....
  540.