4D v16.3

Web/Log (type) page

Home

 
4D v16.3
Web/Log (type) page

Web/Log (type) page  


 

4D allows you to obtain a log of requests.

This file is named “logweb.txt” and is automatically located:

  • with 4D in local mode and 4D Server, in the Logs folder located next to the database structure file.
  • with 4D in remote mode, in the Logs subfolder of the 4D client database folder (cache folder).

The activation and configuration of the log file contents is carried out in the Database Settings on the Web/Log (type) page:

Note: The activation and deactivation of the log file of requests can also be carried out by programming using the SET DATABASE PARAMETER (4D v12) or WEB SET OPTION (4D v13 and higher) commands.

The log format menu provides the following options:

  • No Log File: When this option is selected, 4D will not generate a log file of requests.
  • CLF (Common Log Format): When this option is selected, the log of requests is generated in CLF format. With the CLF format, each line of the file represents a request, such as:
    host rfc931 user [DD/MMM/YYYY:HH:MM:SS] "request" state length
    Each field is separated by a space and each line ends by the CR/LF sequence (character 13, character 10).
    • host: IP address of the client (ex. 192.100.100.10)
    • rfc931: information not generated by 4D, it’s always - (a minus sign)
    • user: user name as it is authenticated, or else it is - (a minus sign). If the user name contains spaces, they will be replaced by _ (an underscore).
    • DD: day, MMM: a 3-letter abbreviation for the month name (Jan, Feb,...), YYYY: year, HH: hour, MM: minutes, SS: seconds
The date and time are local to the server.
    • request: request sent by the client (ex. GET /index.htm HTTP/1.0)
    • state: reply given by the server.
    • length: size of the data returned (except the HTTP header) or 0.

Note: For performance reasons, the operations are saved in a memory buffer in packets of 1Kb before being written to disk. The operations are also written to disk if no request has been sent every 5 seconds.
The possible values of state are as follows:
200: OK
204: No contents
302: Redirection
304: Not modified
400: Incorrect request
401: Authentication required
404: Not found
500: Internal error
The CLF format cannot be customized.

  • DLF (Combined Log Format): When this option is selected, the request log is generated in DLF format. DLF format is similar to CLF format and uses exactly the same structure. It simply adds two additional HTTP fields at the end of each request: Referer and User-agent.
    • Referer: Contains the URL of the page pointing to the requested document.
    • User-agent: Contains the name and version of the browser or software of the client at the origin of the request.

The DLF format cannot be customized.

  • ELF (Extended Log Format): When this option is selected, the request log is generated in ELF format. The ELF format is very widespread in the world of HTTP browsers. It can be used to build sophisticated logs that meet specific needs. For this reason, the ELF format can be customized: it is possible to choose the fields to be recorded as well as their order of insertion into the file.
  • WLF (WebStar Log Format): When this option is selected, the request log is generated in WLF format. WLF format was developed specifically for the 4D WebSTAR server. It is similar to the ELF format, with only a few additional fields. Like the ELF format, it can be customized.

Configuring the fields
When you choose the ELF (Extended Log Format) or WLF (WebStar Log Format) format, the “Weg Log Token Selection” area displays the fields available for the chosen format. You will need to select each field to be included in the log. To do so, use the arrow buttons or simply drag and drop the desired fields into the “Selected Tokens” area.

Note: You cannot select the same field twice.

The following table lists the fields available for each format (in alphabetical order) and describes its contents:

FieldELFWLFValue
BYTES_RECEIVEDXNumber of bytes received by the server
BYTES_SENTXXNumber of bytes sent by the server to the client
C_DNSXXIP address of the DNS (ELF: field identical to the C_IP field)
C_IPXXIP address of the client (for example 192.100.100.10)
CONNECTION_IDXConnection ID number
CS(COOKIE)XXInformation about cookies contained in the HTTP request
CS(HOST)XXHost field of the HTTP request
CS(REFERER)XXURL of the page pointing to the requested document
CS(USER_AGENT)XXInformation about the software and operating system of the client
CS_SIPXXIP address of the server
CS_URIXXURI on which the request is made
CS_URI_QUERYXXRequest query parameters
CS_URI_STEMXXPart of request without query parameters
DATEXXDD: day, MMM: 3-letter abbreviation for month (Jan, Feb, etc.), YYYY: year
METHODXXHTTP method used for the request sent to the server
PATH_ARGSXCGI parameters: string located after the “$” character
STATUSXXReply provided by the server
TIMEXXHH: hour, MM: minutes, SS: seconds
TRANSFER_TIMEXXTime requested by server to generate the reply
USERXXUser name if authenticated; otherwise - (minus sign).
If the user name contains spaces, they are replaced by _ (underlines)
URLXURL requested by the client

Note: Dates and times are given in GMT.



See also 

Web/Log (backup) page

 
PROPERTIES 

Product: 4D
Theme: Database Settings

 
HISTORY 

 
ARTICLE USAGE

4D Design Reference ( 4D v16)
4D Design Reference ( 4D v16.1)
4D Design Reference ( 4D v16.3)