logswan

Fast Web log analyzer using probabilistic data structures
Log | Files | Refs | README | LICENSE

commit 163109429f551ff173fdd2bcce0e287e7a5b3e3a
parent e12b0d51f5a644589d4160b450957ceb0ea94773
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Sun, 28 Jun 2015 22:43:58 +0200

Counting hits per protocol (HTTP/1.0 or HTTP/1.1)

Diffstat:
Msrc/logswan.c | 13++++++++++++-
Msrc/results.h | 1+
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/logswan.c b/src/logswan.c @@ -61,6 +61,11 @@ const char *errstr; int getoptFlag; int main (int argc, char *argv[]) { + char *protocols[] = { + "HTTP/1.0", + "HTTP/1.1" + }; + printf("-------------------------------------------------------------------------------\n" \ " Logswan (c) by Frederic Cambus 2015 \n" \ "-------------------------------------------------------------------------------\n\n"); @@ -135,7 +140,13 @@ int main (int argc, char *argv[]) { } /* Parse request */ - parseRequest(&parsedRequest, parsedLine.resource); + parseRequest(&parsedRequest, parsedLine.resource); + + for (int loop = 0; loop<2; loop++) { + if (!strcmp(protocols[loop], parsedRequest.protocol)) { + results.protocols[loop] ++; + } + } /* Count HTTP status codes occurences */ if (parsedLine.statusCode) { diff --git a/src/results.h b/src/results.h @@ -29,6 +29,7 @@ struct results { int httpStatus[STATUS_CODE_MAX]; double runtime; char timeStamp[20]; + int protocols[2]; }; typedef struct results Results;