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
'Python > Python for Windows' 카테고리의 다른 글
윈도우 2012 NTP 서버 구축 (1) - 외부 인터넷 시간 동기화 설정 (0) | 2019.08.07 |
---|---|
윈도우 2012 NTP 서버 구축 (4) - NTP 서버 설정 (0) | 2019.08.07 |
윈도우 2012 NTP 서버 구축 (3) - 모니터링결과 메일 받기 (0) | 2019.08.07 |
윈도우 2012 NTP 서버 구축 (2) - 서버 시간 모니터링 (0) | 2019.08.07 |
python을 이용한 IIS web log 분석 (5) - DB화 (0) | 2019.07.15 |
python을 이용한 IIS web log 분석 (4) - 파일 확장자 (0) | 2019.07.15 |
python을 이용한 IIS web log 분석 (3) - 클라이언트 IP 국가식별 (0) | 2019.07.15 |
윈도우 성능 데이터 분석 3부 - 사례를 이용한 grafana 시각화 (0) | 2019.06.26 |