Gnutella Forums

Gnutella Forums (https://www.gnutellaforums.com/)
-   General Gnutella / Gnutella Network Discussion (https://www.gnutellaforums.com/general-gnutella-gnutella-network-discussion/)
-   -   Logging Gnutella network statistics to a database (https://www.gnutellaforums.com/general-gnutella-gnutella-network-discussion/7197-logging-gnutella-network-statistics-database.html)

mckerrell January 14th, 2002 12:42 PM

Logging Gnutella network statistics to a database
 
Hi,
Are there any programs available, preferable for unix, that will log the packets that pass through them into a database. I have actually written a client myself but I wouldn't want to trust that my program was not hurting the network :)
Any suggestion for a specific program or possibly a program that would be easily modified? I had a look through gnut but couldn't really find my way.
Look forward to your replies,
John
P.S. I imagine that what the gnutellameter.com guy uses might be good but I've not found a link on the site to download software/email them

hermaf January 15th, 2002 12:49 AM

I also did some analysis for my thesis: I log everything using the syslog function on a Linux system.

it shoul be simple: just send all the packets you receive and send to syslog. BUT you know thats gonna be a lot of data in a short time....

mckerrell January 15th, 2002 11:51 AM

Quote:

Originally posted by hermaf
it shoul be simple: just send all the packets you receive and send to syslog. BUT you know thats gonna be a lot of data in a short time.... [/B]
Is there some automatic way I can do this? Editing a config file or something?

Thinking about it it does sound like a good idea. I can leave all the routing functions to someone else's gnutella client and just do a bit of parsing myself. Data storage should be fine, but can you suggest a meg(gig?!)/day throughput I might get?
John

hermaf January 15th, 2002 12:25 PM

Actually it is pretty simple:
This is my C File called Logging.c It's pretty simple.

#include <syslog.h>
#include <stdio.h>

#include "Logging.h"


void initLog()
{
openlog("qtella logging", LOG_PID, LOG_LOCAL0);
}

void logEntry(const char* message)
{
syslog (LOG_NOTICE, message);
}

void closeLog()
{
closelog();
}


I suggest you read the manpages for:

syslog
syslog.conf

They are very good.

So before you log something call openLog() when you are done closeLog().

To log data call logEntry(const char* message). If you want you can add more parameters to the function call eg. the severity level (LOG_NOTICE).

To include the file in C++ you have to use

extern "C" {
#include "Logging.h"
}

That's it ... for C/C++

To store the data to a file you have to open syslog.conf usually located in /etc/ and add something like:
local0.* /var/log/qtella.log
if you used LOG_LOCAL0 to open syslog.

Then restart syslog or use the SIGHUP signal to reread the conf file.

All done now ;)


Quote:

you suggest a meg(gig?!)/day throughput I might get?
Hard to tell but you can calculate: Take the biggest paket size (I guess query Hit?) with some hits (5?) and add some bytes for the syslog data that come first in the file (about 50 bytes per entry)and check how many packets you receive in one hour then you can calculate...

As far as I know syslog creates a new file if the old one gets too big but I don't know at which file size this happens...

mckerrell January 15th, 2002 01:06 PM

Thanks, this looks really useful. I'll hopefully get a while to play with it at the weekend :)
John


All times are GMT -7. The time now is 12:13 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.