Skip to content

Conversation

@hengfeiyang
Copy link
Contributor

@hengfeiyang hengfeiyang commented Nov 3, 2025

This PR add custom format support for http access log:

default format is:

%a "%r" %s %b "%{Content-Length}i" "%{Referer}i" "%{User-Agent}i" %T

You can easily to set it as json format:

ZO_HTTP_ACCESS_LOG_FORMAT="json"

The format will be:

{ "remote_ip": "%a", "request": "%r", "status": %s, "response_size": %b, "request_size": "%{Content-Length}i", "referer": "%{Referer}i", "user_agent": "%{User-Agent}i", "response_time_secs": %T }

Or you can custom it only log request line and took time:

ZO_HTTP_ACCESS_LOG_FORMAT='"%r" took: %T'

The format spec:

%a - Remote IP address
%t - Time when the request was received
%r - First line of request
%s - Response status code
%b - Size of response in bytes, excluding HTTP headers
%U - URL path requested
%T - Time taken to serve the request, in seconds
%D - Time taken to serve the request, in microseconds
%i - Header line(s) from request
%o - Header line(s) from response
%{Content-Length}i - Size of request payload in bytes
%{Referer}i - Referer header
%{User-Agent}i - User-Agent header

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Failed to generate code suggestions for PR

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: hengfeiyang | Branch: feat/http-log-format | Commit: c173bb1

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 376 351 0 21 4 93% 4m 32s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: hengfeiyang | Branch: feat/http-log-format | Commit: c173bb1

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 376 352 0 21 3 94% 4m 34s

View Detailed Results

@hengfeiyang hengfeiyang merged commit fb48f6a into main Nov 3, 2025
34 of 38 checks passed
@hengfeiyang hengfeiyang deleted the feat/http-log-format branch November 3, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants