22 November 1999 Configuring the SRE-http Common-Log Audit File A) Introduction In keeping with http server standards, SRE-http will maintain a common-log format audit file. Besides offering a compact synopsis, a number of tools exist to help you analyze common-log files. Furthermore, as an adjunct to the common-log audit file, SRE-http can also record the browser used by each request (as well as the referer) in seperate log files. This document discusses how to modify the SREFLOGS.INI file. SREFLOGS.INI (which should be in the CFGS\ subdirectory of your GoServe working directory) contains the configuration options for these three log files. These options include the host-specific (and port-specfic) filenames for these log files, audit-suppression instructions, and a few display options. At this moment, there is no SRE-http configurator for SREFLOGS.INI -- you'll have to use your favorite text editor. Also note that, as with most other SRE-http configuration files, you can change it on the fly (SRE-http checks SREFLOGS.INI about every 20 seconds). SREFLOGS.INI can be also be used to run programs on a scheduled basis. However, we now recommend use of the "scheduling daemon" (as described in SCHEDULE.DOC) to specify scheduled events. ------------------------------------------------- B) Basic configuration A few basic points: i) If you want to record information to these audit files, you need to enable the WRITE_LOGS parameter (you can use the configurator to do this). ii) If you are running a single-host server on port 80, and you are happy to record all requests in a standard fashion, then you can use the default version of SREFLOGS.INI. If you choose to do this, several files in the DATA\ directory of the GoServe "working directory" (say, D:\GOSERVE\DATA) will be created (and written to): * COMMON.LOG -- the common-log audit file * BROWSERS.LOG -- list of browsers * REFERER.LOG -- list of referers * COMBINED.LOG -- combination of common, referer, and browser logs. iii) If post-filter processing has been suppressed (say, with the SEL-specific NO_POSTFILTER permission), the request will not be recorded to these audit files. iv) Advanced options: * You can instruct SRE-http to rename log files when they become too large; thereby resetting the size of the log file to 0 bytes. To do this, you should set the LOGFILE_MAXSIZE parameter in SREFMON.CMD (see INITFILT.DOC for more details on LOGFILE_MAXSIZE). * SRE-http will "lazy write" the audit files (about once a minute). SRE-http will also warn you (via the PMPRINTF window) when a log file gets large (greater then 1M). You can change these limits by editing the POSTFCHK.RXX file. * SRE-http will add the host-nickname to common log file entries. You can suppress (or enhance) this feature by modiffying the ADD_HOSTNICKNAMES parameter in POSTFCHK.RXX. ------------------------------------------------- C) Configuration options Configuration is accomplished by setting variables in SREFLOGS.INI. The following lists the variables, with details below: COMMONLOG == Default common-log file COMMONLOG.nnn == Common-log file for port nnn server. COMMONLOG.hostn == Common-log file for the "hostn" host. COMMONLOG.hostn.nnn == Common-log file for the "hostn" host on port nnn. BROWSERLOG == Default browser log file BROWSERLOG.nnn == Browser log file for port nnn server. BROWSERLOG.hostn == Browser log file for the "hostn" host. BROWSERLOG.hostn.nnn == Browser log file for the "hostn" host on port nnn. REFERERLOG == Default referer log file REFERERLOG.nnn == Referer log file for port nnn server. REFERERLOG.hostn == Referer log file for the "hostn" host. REFERERLOG.hostn.nnn == Referer log file for the "hostn" host on port nnn. COMBINEDLOG == Default combined (common/referer/browser) log file COMBINEDLOG.nnn == Cominbedlog file for port nnn server. COMBINEDLOG.hostn == Combined log file for the "hostn" host. COMBINEDLOG.hostn.nnn == Combined log file for the "hostn" host on port nnn. APACHE_MODE == Select format for Browser and Referer logs FORCE_REFERER == Use a " - " when no referer request header is available NOOPTIONS == Do not record the portion of the request selector following the ? NOHTTP == Do not record the HTTP/1.0 portion of the request string NOCODES == List of "return codes" and "http methods" to not record. NOUSER == List of IP addresses, and SRE-http "usernames", to not record NOREFERER == List of IP addresses to not record in REFERER.LOG (COMMON, COMBINED and BROWSER logs do NOT pay attention to this parameter). NOURL == Rquest selectors to not record SCHED == Scheduled programs to run C.1) Configuration Details: COMMONGLOG, COMBINEDLOG, BROWSERLOG and REFERERLOG ---- The COMMONLOG, COMBINEDLOG, BROWSERLOG, and REFERERLOG "stem" variables all have the same structure. The basic notion is that SRE-http will take the server port, and the server's host nickname, and attempt to find matching COMMONLOG (and COMBINEDLOG, BROWSERLOG and REFERERLOG) variables. If a match is not found, the "default" variables are used. You should set these stem variable to equal filenames. If you use a relative file name (i.e.; FOO.BAR or DIR1/FOO.BAR), the file is assumed to be relative to the DATA\ subdirectory of the GoServe working directory. Note that SREFLOGS.INI prior to SRE-http ver 1.3d, SREFLOGS.INI was in the DATA\ subdirectory; as of 1.3d, SREFLOGS.INI is in the CFGS\ subdirectory. Some examples should help. These examples use COMMONLOG, but the logic is exactly the same for COMBINEDLOG, BROWSERLOG and REFERERLOG. For these examples, assume the following entries in SREFLOGS.INI (also assume that the DATA\ subdirectory is D:\GOSERVE\DATA) COMMONLOG='COMMON.LOG' COMMONLOG.CIRCUS.8080='CIRCUS\COMMON.8080' COMMONLOG.ZOO='D:\CIRCUS\WWW\COMMON.LOG' Example 1: if the server is a single host (no host nicknames specified) on the standard port (80), then SRE-http would look for: COMMONLOG.80 -- this is the first variable looked for COMMONLOG -- the default Since COMMONLOG.80 was not specified, COMMONLOG is used (which yields a value of D:\GOSERVE\DATA\COMMON.LOG). Note that this example also applies to non-standard ports on single host systems (with the .80 changed appropriately). Example 2: port 80, host nickname of ZOO: COMMONLOG.ZOO.80 -- this is the first variable looked for COMMONLOG.ZOO -- this is the second variable looked for COMMONLOG -- this is the default COMMONLOG.ZOO.80 was not specified, but COMMONLOG.ZOO was. Thus, the value will be D:\CIRCUS\WWW\COMMON.LOG. Example 3: port 8080, "host nickname" of CIRCUS: COMMONLOG.CIRCUS.8080 -- this is the first variable looked for COMMONLOG.CIRCUS -- this is the second variable looked for COMMONLOG -- this is the default Since COMMONLOG.CIRCUS.8080 exists; so the value will be D:\GOSERVE\DATA\CIRCUS\COMMON.8080 (D: must be an HPFS drive). If the desired default is to not record, set COMMONLOG=0. Note that you can override this default on a host-nickname/port specific basis. As stated above, the COMBINEDLOG, BROWSERLOG and REFERERLOG variables are treated the same way. Thus, to suppress the REFERERLOG, set REFERERLOG=0 (and have no other REFERERLOG. variables). C.2a) The NOxxx,and other options -------------------------------------- The followings options allow you to modify the output to the common-log file, and to suppress the recording of selected requests. APACHE_MODE: If APACHE_MODE=1, then the referer and browser log's are written using an "Apache" mode (that is, something similar to what Apache server's write). If APACHE_MODE=0, then a "GoHTTP" mode is used. For example: APACHE_MODE (browser and referer logs): [14/Mar/1996:17:45:08] Mozilla/2.0 (X11; I; HP-UX A.09.05 9000/735) [14/Mar/1996:17:48:10] http://guide-p.infoseek.com/Titles -> /~sret1/analog/ GoHTTP: [03/Jun/1997:19:35:16 -0500] DAL40-29.PPP.IADFW.NET Mozilla/2.02E (OS/2; I) [2/Mar/1997:18:23:37 -0500] "/imgs/srefiltr.gif" http://ship.float.net/ FORCE_REFERER: If FORCE_REFERER=1, then in cases where there is no referer, a " - " is used. NOOPTIONS: If NOOPTIONS=1, then the portion of the request selector following a ? will not be included. Since this can be quite long (as when you are using the GET method in an HTML FORM), inclusion of this information can lead to very long (and hard to read) entries. For example: given a request for: /LOOK1?arg1=sub1/&arg2=1&argx=1&xmac=0 if NOOPTIONS=1, the "request" portion of the common-log (and referers log) will be /LOOK1 NOHTTP Technically, a request string should end with the HTTP version. Since this is almost always HTTP/1.0, and since it's not clear that the common-log format requires this information, you can suppress this portion of the request string by setting NOHTTP=1. NOCODES NOCODES should contain a space delimited list of 3 digit "return status codes", and http-methods, that you do NOT want to record. For example, you may not be interested in requests that generated a "authorization response" (a 401 response). If so, set: NOCODES='401 ' If you are also uninterested in "moved" responses, you can set: NOCODES='401 301 302 ' If you are not interested in "authorization responses" and responses to HEAD method requests: NOCODES='401 HEAD' And if you are sort of perverse, and are not interested in normal responses, you can set: NOCODES='200 ' If the response code, or the request method, matches one of these NOCODES, then none of the log files are written to. NOUSER This should contain a space delimited list of IP names (or numeric addresses for those clients with no IP name) that you do NOT wish to record. It can also contain "usernames" (from SRE-http's USERS.IN usename/password database). That is, requests from these addresses (and from these "users") will NOT be recorded. One sensible use of this is to include OWNER's IP address (since you probably don't care about requests you make to yourself), as well as the "usernames" of the various SUPERUSERs. Note that if you take this suggestion, you must put in the OWNER's IP name (in contrast, the SRE-http OWNERS variable expects a numeric IP address). Example: NOUSER=' joe.bars.net *.wah.com 151.121.55.6 ADMINX ' Notes: * you can use * as a wildcard for a field. Thus, ab.wah.com and cd.wah.com would both match *.wah.com, but www.ef.wah.com would NOT. * If 151.121.55.6 has an IP name of jill.money.gov, she would NOT match 151.121.55.6 -- 151.121.55.6 would only match if there was NO ip name available. * ADMINX is a possible "username" (possibly of a SUPERUSER). * If a match to any of these NOCODES occurs, then none of the log files are written to. NOREFERER This should contain a space delimited list of IP names (or numeric addresses for those clients with no IP name) that you do NOT wish to record in the REFERER.LOG file. That is, requests that were refered from these addresses will NOT be recorded in REFERER.LOG. However, these requests WILL be recorded in the common.log, combined.log, and browser.log files. Example: NOREFERER=' *.my.site.net backup.site.org ' Notes: * you can use * as a wildcard for a field. Thus, ab.wah.com and cd.wah.com would both match *.wah.com, but www.ef.wah.com would NOT. * If 151.121.55.6 has an IP name of jill.money.gov, she would NOT match 151.121.55.6 -- 151.121.55.6 would only match if there was NO ip name available. NOURL The NOURL entries should contain URLs to NOT record. That is, if a request selector matches one of these URLs, it will NOT be recorded. For example: NOURL = 'IMGS/* NOURL = 'BORING/TEDIOUS.HTM ' Notes: * You can include * as a wildcard. Thus, IMGS/HORSE.GIF matches NOURL, and such requests would NOT be recorded the common-log, etc. audit files. * These entries are NOT sensitive to host or port -- all NOURL entries will apply to all hosts and ports (perhaps we'll fix this up if there's enough demand). * If a request selector matches one of these NOURL variables, then none of the log files are written to. * The several SRE-http hit suppresion options (such as HIT_OWNER_SUPPRESS, have NO effect on these audit files). * \ are converted to /, and leading / are stripped. * You can also use the older (prior to sre-htt ver 1.3b.1298c) of: NOURL.1 ='xxx' NOURL.2='yyyy' NOURL.3=0 SCHED SCHED='frequency prog_name argument' entries can be included in SREFLOGS.INI. However, this has been deprecated -- the use of SCHEDULE.CFG is recommened instead (see SCHEDULE.DOC for the details). ------------------------------------------------- D) Structure of .LOG files i) The common-log file format ------------------- (the following description is adapted from http://www.apache.org/docs/mod/mod_log_common.html) The common-log file contains a separate line for each request. A line is composed of several items (tokens) separated by spaces: host ident authuser date request status bytes If a token does not have a value then it is represented by a hyphen (-). The meanings and values of these tokens are as follows: client The fully-qualified domain name of the client, or its IP number if the name is not available. ident The identd identity information: NOT SUPPORTED BY SRE-http. authuser The client's username, as provided in the AUTHORIZATION request header. Note that the common-log standard suggests that "if the request was for a password protected document, then this is the userid used in the request". However, SRE-http will always include the authuser (if available), even if the particular request did not require authorization. date The date and time of the request, in the following format: date = [day/month/year:hour:minute:second zone] where: day = 2 digit month = 3 letter year = 4 digit hour = 2 digit minute = 2 digit second = 2 digit zone = (`+' | `-') 4 digit request The request line from the client, enclosed in double quotes status The three digit status code returned to the client. bytes The number of bytes in the object returned to the client, not including any headers. For example: acl.wear.org - - [18/Mar/1996:16:24:08 -0500] "GET /SMP/HLO.HTM HTTP/1.0" 200 1251 In the above example, the HTTP/1.0 substring may not be standard (you can suppress it by setting the NOHTTP option in SREFLOGS.INI). Also note that -0500 corresponds to the EST offset from GMT. ii) The BROWSERS log file --------------------- The browsers log file has the following structure: [date] client : user-agent For example: [24/Feb/1997:18:14:30 -0500] 151.121.65.143 : IBM-WebExplorer-DLL/v1.1b iii) The REFERERS log file ---------------------- The referers log file has the following structure: [date] "sel" referer_url Where SEL is from the request string, and the referer_url is from the REFERER request header. For example: [24/Feb/1997:18:18:19 -0500] "/SAMPLES/samp1.htm" http://dh.ag.gov/i.htm (http://dh.ag.gov/i.htm contained a link to /samples/samp1.htm) Note: if a request does not have a REFERER request header (for example, WebEx does not provide a REFERER request header): if FORCE_REFERER=0, an entry will NOT be added to the REFERERS log. FORCE_REFERER=1, a referer of " - " is used. iv)The COMBINEDLOG log file The combined log file combines the common, referer, and browser logs. It has the following structure: PARROT.HALL.NET - - [04/Jun/1997:22:38:16 -0400] "GET /imgs/justscal.gif" 200 516 "http://mysite.heights.edu/SAMPLES/guide.htm" "Mozilla/2.02E (OS/2; I)" (but all on one long line). -- End of documentation.