diff --git a/doc/gmnisrv.scd b/doc/gmnisrv.scd index 80de229..042deb3 100644 --- a/doc/gmnisrv.scd +++ b/doc/gmnisrv.scd @@ -20,6 +20,20 @@ provides the -C flag. *-C* _path_ 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 *gmnisrv.ini*(5) diff --git a/src/server.c b/src/server.c index 958ad64..21ad29e 100644 --- a/src/server.c +++ b/src/server.c @@ -179,11 +179,10 @@ disconnect_client(struct gmnisrv_server *server, struct gmnisrv_client *client) clock_gettime(CLOCK_MONOTONIC, &now); timespec_diff(&client->ctime, &now, &diff); int ms = diff.tv_sec * 1000 + (int)(diff.tv_nsec / 1.0e6); - client_log(&client->addr, "%3dms %5d %s %s %02d %s", - ms, client->bbytes, + client_log(&client->addr, "%s %s %3dms %5d %02d %s", client->host ? client->host->hostname : "(none)", client->path ? client->path : "(none)", - (int)client->status, client->meta); + ms, client->bbytes, (int)client->status, client->meta); } if (client->bio) { BIO_free_all(client->bio);