summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-09-26 17:02:06 -0400
committerDrew DeVault <sir@cmpwn.com>2020-09-26 17:02:06 -0400
commit814a6e7657b6db75656c3165568bc8069b94d04f (patch)
tree9a4a00d6bcee8a493cdf4ae2ef7719c8969cf97f
parentc601583f7d729789e817ce085793ac5f7493b52e (diff)
downloadgmnisrv-814a6e7657b6db75656c3165568bc8069b94d04f.tar.gz
gmnisrv-814a6e7657b6db75656c3165568bc8069b94d04f.tar.xz
gmnisrv-814a6e7657b6db75656c3165568bc8069b94d04f.zip
Document (and tweak) log format
-rw-r--r--doc/gmnisrv.scd14
-rw-r--r--src/server.c5
2 files changed, 16 insertions, 3 deletions
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);