From: Razvan Deaconescu Date: Sat, 21 Nov 2009 19:11:23 +0000 (+0200) Subject: updated libtorrent run_sample script to use log parser; updated README file accordingly X-Git-Tag: getopt_long~241 X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=f0b8a80ebfedbce355256192d2a3cabac52f1561;p=cs-p2p-next.git updated libtorrent run_sample script to use log parser; updated README file accordingly --- diff --git a/log-parser/libtorrent/README b/log-parser/libtorrent/README index 8ec9438..3780f4e 100644 --- a/log-parser/libtorrent/README +++ b/log-parser/libtorrent/README @@ -6,15 +6,20 @@ Lines are parsed and written to status_messages table in database. Its arguments are a client session id, the status filename and the database filename. -** Draft ** +== LogParser.py == -* At this point, there is no database interraction (DatabaseWriter.py -function call is commented out). -* Sample call: +libtorrent verbose log files parser. Receives a verbose log file as argument. +Basename must have ${IP_ADDRESS}_${LISTEN_PORT}.log syntax. ---- -razvan@valhalla:~/projects/p2p-next/cs-p2p-next/log-parser/libtorrent$ PYTHONPATH=../../auto/db/ python StatusParser.py -i 2 -f ../../log-samples/libtorrent/libtorrent-status.sample.log ../../auto/db/p2p-next.db ---- +The parser recognizes the message types as defined in the BitTorrent +specification[1]. -* Some debug output messages can be enabled by initializing the DEBUG -global variable in the StatusParser.py to True. +== sample run == + +In order to see the above modules at work, use the run_sample script. Just +use a simple command + ./run_sample + +Check the script to see the calling syntax for the above modules. The sample +files are locate in ../../log-samples/libtorrent/ +[1] http://wiki.theory.org/BitTorrentSpecification diff --git a/log-parser/libtorrent/run_sample b/log-parser/libtorrent/run_sample index de75400..e62c3a2 100755 --- a/log-parser/libtorrent/run_sample +++ b/log-parser/libtorrent/run_sample @@ -1,3 +1,20 @@ #!/bin/bash -PYTHONPATH=../../auto/db/ python StatusParser.py -i 2 -f ../../log-samples/libtorrent/libtorrent-status.sample.log ../../auto/db/p2p-next.db +DB_NAME=test.db + +# remove database in case it exists +rm -f $DB_NAME + +# create database +pushd . &> /dev/null +cd ../../auto/db && ./db_init ../../log-parser/libtorrent/$DB_NAME +popd &> /dev/null + +# fill database with test data +PYTHONPATH=../../auto/db/ python ../../auto/db/DatabaseAccess.py $DB_NAME + +# fill status information +PYTHONPATH=../../auto/db/ python StatusParser.py -i 1 -f ../../log-samples/libtorrent/libtorrent-status.sample.log $DB_NAME + +# fill logging information +PYTHONPATH=../../auto/db/ python LogParser.py -i 1 -f ../../log-samples/libtorrent/141.85.224.222_50200.log $DB_NAME