Cloud Platform

Using HTTP request IDs

When Cloud Platform receives a web request, it assigns each request a unique request ID, in the HTTP header X-Request-ID, and preserves that request ID across multiple log files. The HTTP request ID can help you diagnose problems by correlating log entries for a given web request across many log files, which otherwise would not contain a common piece of information. Even on a busy website, the HTTP request ID in the log files makes it easy to correlate various log entries with each other.

For example, having the HTTP request ID in the PHP error log is helpful because it will also appear in the Apache request log, enabling you to identify the page request that generated the PHP error. After identifying the page request, you can more easily reproduce the bug causing the issue.

The HTTP request ID is recorded with the request_id="" syntax in all logs directly related to the request, including the following log files:

Web requests can access the HTTP request ID using the $_ENV['HTTP_X_REQUEST_ID'] environment variable.

The HTTP request ID is 20 to 200 characters long, and includes only the following characters:

  • a-z (lowercase)

  • A-Z (uppercase)

  • 0-9

  • + (plus sign)

  • / (slash mark)

  • = (equal sign)

  • - (minus sign)


You can provide your own X-Request-ID header in your application, and Cloud Platform will use the value you supply.