diff --git a/tsstats/__main__.py b/tsstats/__main__.py index 5e7e621..e469b92 100644 --- a/tsstats/__main__.py +++ b/tsstats/__main__.py @@ -69,8 +69,13 @@ def main(config=None, idmap=None, log=None, if not log or not output: raise InvalidConfiguration('log or output missing') - clients = parse_logs(log, ident_map=identmap, online_dc=noonlinedc) - render_template(clients, output=abspath(output)) + sid_clients = parse_logs(log, ident_map=identmap, online_dc=noonlinedc) + for sid, clients in sid_clients.items(): + if sid: + ext = '.{}'.format(sid) + else: + ext = '' + render_template(clients, output=abspath(output + ext)) if __name__ == '__main__': diff --git a/tsstats/log.py b/tsstats/log.py index 08570f6..5b3bf43 100644 --- a/tsstats/log.py +++ b/tsstats/log.py @@ -2,11 +2,15 @@ import logging import re +from collections import namedtuple from datetime import datetime from glob import glob +from os.path import basename from tsstats.client import Client, Clients +re_log_filename = re.compile(r'ts3server_(?P\d{4}-\d\d-\d\d)' + '__(?P