DB화가 되었으니 SQL쿼리문을 통해서 분석이 가능하다.
# 2019년 6월 3일 9시 서버에서 보낸 용량 총합
import sqlite3
conn = sqlite3.connect(r'C:\log\weblog_sqlite3.db')
c= conn.cursor()
rows = c.execute('''select sum(scbytes) from weblog where logtime between '2019-06-03 09:00:00' and '2019-06-03 09:59:59' ''')
for i in rows:
print(i[0])
c.close()
conn.close()
----------------------------------------------------------------------
23972592093 (23.9G)
# 국가별 인입 통계 (라인수)
rows = c.execute('''select country, count(country) as gun from weblog group by country order by gun desc ''')
# 응답코드별 통계
rows = c.execute('''select scstatus, count(scstatus) as gun from weblog group by scstatus order by gun desc ''')
200 1455209
304 270270
302 18303
206 4520
400 533
999 44
500 11
401 2