logswan

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

commit e1767310b4272d6ce90a247ee3cdbeffbe95a6dc
parent 1f387d5993ea07b374b8f3976ab9229b5602372d
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Thu, 11 Jun 2015 00:02:41 +0200

Counting number of IPv4 and IPv6 hits

Diffstat:
MREADME.md | 41+++++++++++++++++++++--------------------
Msrc/logswan.c | 8+++++++-
2 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/README.md b/README.md @@ -1,5 +1,5 @@ # Logswan - + Logswan is a Web log analyzer in early stages of development. It is targeted at very large log files, typically APIs logs. Project design goals include : speed, memory-usage efficiency, and keeping the code as simple as possible. @@ -9,33 +9,34 @@ Project design goals include : speed, memory-usage efficiency, and keeping the c Currently implemented features : - Counting number of hits +- Counting number of IPv4 and IPv6 hits - Counting bandwidth used - Counting log file size ## Compiling -Logswan uses the CMake build system : +Logswan uses the CMake build system : cmake . make -## Usage +## Usage Logswan takes the input log file as parameter : - - logswan inputfile - -## License - -Logswan is released under the BSD 3-Clause license. See `LICENSE` file for details. - -## Author - -Logswan is developed by Frederic Cambus - -- Site : http://www.cambus.net -- Twitter: http://twitter.com/fcambus - -## Resources - -GitHub : https://github.com/fcambus/logswan + + logswan inputfile + +## License + +Logswan is released under the BSD 3-Clause license. See `LICENSE` file for details. + +## Author + +Logswan is developed by Frederic Cambus + +- Site : http://www.cambus.net +- Twitter: http://twitter.com/fcambus + +## Resources + +GitHub : https://github.com/fcambus/logswan diff --git a/src/logswan.c b/src/logswan.c @@ -4,7 +4,7 @@ /* https://github.com/fcambus/logswan */ /* */ /* Created: 2015/05/31 */ -/* Last Updated: 2015/06/07 */ +/* Last Updated: 2015/06/11 */ /* */ /* Logswan is released under the BSD 3-Clause license. */ /* See LICENSE file for details. */ @@ -31,6 +31,8 @@ uint64_t invalidLines = 0; uint64_t objectSize = 0; uint64_t bandwidth = 0; uint64_t hits = 0; +uint64_t hitsIPv4 = 0; +uint64_t hitsIPv6 = 0; struct sockaddr_in ipv4; struct sockaddr_in6 ipv6; @@ -112,6 +114,8 @@ int main (int argc, char *argv[]) { } /* Increment hits counter */ + hitsIPv4 += isIPv4; + hitsIPv6 += isIPv6; hits++; } else { /* Invalid line */ @@ -126,6 +130,8 @@ int main (int argc, char *argv[]) { /* Printing results */ printf("Hits : %llu\n", hits); + printf("Hits (IPv4): %llu\n", hitsIPv4); + printf("Hits (IPv6): %llu\n", hitsIPv6); printf("Invalid lines : %llu\n", invalidLines); printf("Bandwidth : %llu\n", bandwidth); printf("Log file size : %llu\n", logFileSize.st_size);