Request Logging

Record every web request GlobalForms receives, such as page loads, form submissions and API calls, in a log file. Request logs help you investigate errors, unexpected traffic and integration problems.

This feature requires GlobalForms version 10.7.1 or greater. Request logging is off by default.

Turn on request logging

  1. Add the following to config\local.json:

    JSON
    {
      "settings": {
        "logging": {
          "request": {
            "enabled": true
          }
        }
      }
    }
    
  2. Restart the GlobalForms service.

Requests are written to logs\request.log in the install folder. A new file is started each day.

Settings

Setting

Default

Description

enabled

false

Turns request logging on or off.

format

"combined"

What each line contains. See Log formats.

file.enabled

true

Write to logs\request.log. Leave this true on Windows servers.

file.interval

"1d"

How often to start a new log file, for example "1h" (hourly), "1d" (daily) or "7d" (weekly). Set to null to keep a single file that keeps growing.

options.immediate

false

When true, each request is logged as soon as it arrives instead of when it finishes. Use this when investigating crashes. The status code and response time are not recorded in this mode.

Log formats

Format

What each line includes

combined (default)

Client address, date, request, status, response size, referring page and browser. Best for most investigations.

common

Like combined, without the referring page and browser

short

Client address, request, status, size and response time

tiny

Request, status, size and response time only

You can also define your own format, for example:

JSON
{
  "settings": {
    "logging": {
      "request": {
        "enabled": true,
        "format": ":date[iso] :method :url :status :response-time ms"
      }
    }
  }
}

Things to consider

  • Disk space: busy servers can produce large logs. Check the logs folder regularly and remove old log files you no longer need.

  • Privacy: request logs contain client IP addresses and the addresses of pages and API calls. Protect the logs folder and keep logs only as long as you need them.

  • Performance: logging adds a small amount of work to each request. Turn it off when you no longer need it.

Troubleshooting

Symptom

Cause and fix

No request.log file appears

Check that settings.logging.request.enabled is true in local.json, that the section names match exactly, and that you restarted the service.

The log has no status codes

options.immediate is true. Set it to false.