commit baafaf38935f949caf81db281fc17bbeb9bbbe6c
parent aef0076447d9ca07b4e758287f611e6cbbda224e
Author: Quentin Rameau <quinq@fifth.space>
Date: Thu, 15 Jun 2017 19:21:31 +0200
Add tcp connection logging
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat:
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/geomyidae.8 b/geomyidae.8
@@ -97,11 +97,12 @@ Set the logging level (default: 7)
.
.Bd -literal
Loglevels:
- 0 - no logging
- 1 - served plain files
- 2 - directory listings
- 4 - HTTP redirects
- 8 - errors (e.g., not found)
+ 0 - no logging
+ 1 - served plain files
+ 2 - directory listings
+ 4 - HTTP redirects
+ 8 - errors (e.g., not found)
+ 16 - client connections
e.g.:
1 + 2 + 4 + 8 = 15
(files + directories + HTTP + errors)
diff --git a/main.c b/main.c
@@ -32,7 +32,8 @@ enum {
FILES = 1,
DIRS = 2,
HTTP = 4,
- ERRORS = 8
+ ERRORS = 8,
+ CONN = 16
};
int glfd = -1;
@@ -476,6 +477,9 @@ main(int argc, char *argv[])
sizeof(clienth), clientp, sizeof(clientp),
NI_NUMERICHOST|NI_NUMERICSERV);
+ if (loglvl & CONN)
+ logentry(clienth, clientp, "-", "connected");
+
switch(fork()) {
case -1:
perror("fork");