1
0
mirror of https://git.sr.ht/~sircmpwn/gmnisrv synced 2024-11-03 06:07:17 -05:00

Document (and tweak) log format

This commit is contained in:
Drew DeVault 2020-09-26 17:02:06 -04:00
parent c601583f7d
commit 814a6e7657
2 changed files with 16 additions and 3 deletions

View File

@ -20,6 +20,20 @@ provides the -C flag.
*-C* _path_ *-C* _path_
Specifies an alternate path to read the config file from. Specifies an alternate path to read the config file from.
# LOG FORMAT
Server diagnostics and client errors are printed to *stderr* in an unspecified
format. Nominal client logging is printed to *stdout*, with each of the
following fields in order, separated by whitespace:
- Client IP
- Request hostname
- Request path
- Service time
- Response body size in bytes
- Response status
- Response meta
# SEE ALSO # SEE ALSO
*gmnisrv.ini*(5) *gmnisrv.ini*(5)

View File

@ -179,11 +179,10 @@ disconnect_client(struct gmnisrv_server *server, struct gmnisrv_client *client)
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
timespec_diff(&client->ctime, &now, &diff); timespec_diff(&client->ctime, &now, &diff);
int ms = diff.tv_sec * 1000 + (int)(diff.tv_nsec / 1.0e6); int ms = diff.tv_sec * 1000 + (int)(diff.tv_nsec / 1.0e6);
client_log(&client->addr, "%3dms %5d %s %s %02d %s", client_log(&client->addr, "%s %s %3dms %5d %02d %s",
ms, client->bbytes,
client->host ? client->host->hostname : "(none)", client->host ? client->host->hostname : "(none)",
client->path ? client->path : "(none)", client->path ? client->path : "(none)",
(int)client->status, client->meta); ms, client->bbytes, (int)client->status, client->meta);
} }
if (client->bio) { if (client->bio) {
BIO_free_all(client->bio); BIO_free_all(client->bio);