From f0b8a80ebfedbce355256192d2a3cabac52f1561 Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Sat, 21 Nov 2009 21:11:23 +0200 Subject: [PATCH] updated libtorrent run_sample script to use log parser; updated README file accordingly --- log-parser/libtorrent/README | 23 ++++++++++++++--------- log-parser/libtorrent/run_sample | 19 ++++++++++++++++++- 2 files changed, 32 insertions(+), 10 deletions(-) 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 -- 2.20.1