SQLite DB의 설명에는 이론상 2^64 개의 Row를 입력 가능하나 최대 DB 용량은 14Terabyes임
schema 생성
sqlite3 fwlog.db "CREATE TABLE fwlog (start_time datetime,end_time datetime,duration int,rule_id int,nat_id int,src_ip varchar(15),src_port int,dest_ip varchar(15),dest_port int,send_packet bigint,rev_packet bigint,send_byte bigint,rev_byte bigint,etc varchar(255))"
평문로그 Import
sqlite3 -separator "," fwlog.db ".import 평문파일명 fwlog"
(되도록이면 10G 미만으로 넣으세요)
분석결과 Export
sqlite3 fwlog.db "select * from fwlog order by duration limit 10000" -csv > fwlog_session_top10000.csv
(이렇게 하면 세션유지 시간이 높은 10000개를 가져옵니다.)
두개의 Table을 Left Outer Join
sqlite3 -csv secuinfra.db "select date,log.dept,name,filename,reason from log left outer join policy_log on log.dept=policy_log.dept and log.name=policy_log.user_name and log.date between policy_log.reg_sdate and policy_log.reg_edate" > secuinfra_USB3.txt