def parse_file(dbname, logfile): parser = logparser(logfile) base = database(dbname) base.create_table() logentries = dict() while parser.readline(): if parser.is_request: if parser.thread in logentries: logentries[parser.thread].add_request(parser.request) #logentries[parser.thread].process(base.cursor) #del logentries[parser.thread] else: logentries[parser.thread] = entry_processor(parser.date, parser.thread, parser.level) logentries[parser.thread].add_request(parser.request) else: if parser.thread in logentries: logentries[parser.thread].add_context(parser.context) logentries[parser.thread].process(base.cursor) del logentries[parser.thread] else: logentries[parser.thread] = entry_processor(parser.date, parser.thread, parser.level) logentries[parser.thread].add_context(parser.context) base.close_connection()
def parse_file(dbname, logfile): parser = logparser(logfile) base = database(dbname) base.create_table() logentries = dict() while parser.readline(): if parser.is_request: if parser.thread in logentries: logentries[parser.thread].add_request(parser.request) #logentries[parser.thread].process(base.cursor) #del logentries[parser.thread] else: logentries[parser.thread] = entry_processor( parser.date, parser.thread, parser.level) logentries[parser.thread].add_request(parser.request) else: if parser.thread in logentries: logentries[parser.thread].add_context(parser.context) logentries[parser.thread].process(base.cursor) del logentries[parser.thread] else: logentries[parser.thread] = entry_processor( parser.date, parser.thread, parser.level) logentries[parser.thread].add_context(parser.context) base.close_connection()
def print_stats(datafile, output, date): base = database(datafile) base.create_table() print "generate dashboard" q = dashboard_queries(base.cursor, output, date) q.generate_dashboard() print "generate graph" q = graph_queries(base.cursor, output, date) q.generate_graph_daily() q.generate_graph_monthly() print "generate main chart" q = main_chart_queries(base.cursor, output, date) q.generate_main_chart_daily() q.generate_main_chart_monthly() print "generate nb request by ua" q = ua_queries(base.cursor, output, date) q.nb_request_by_ua_daily() q.nb_request_by_ua_monthly() print "generate nb request by netloc" q = referer_queries(base.cursor, output, date) q.nb_request_by_netloc_daily() q.nb_request_by_netloc_monthly() print "generate nb visit by visit size" q = visits_queries(base.cursor, output, date) q.nb_visit_by_visit_size_daily() q.nb_visit_by_visit_size_monthly()