python pandas를 이용한 iis-ftp log 파싱
#Fields: date time c-ip c-port cs-username s-sitename s-computername cs-host s-ip s-port cs-method
cs-uri-stem sc-status sc-win32-status sc-substatus sc-bytes cs-bytes time-taken x-session x-fullpath
x-debug
import pandas as pd
log_field = ['date', 'time', 'c-ip', 'c-port' , 'cs-username', 's-sitename', 's-computername', 'cs-host',
's-ip', 's-port', 'cs-method' ,'cs-uri-stem' ,'sc-status', 'sc-win32-status', 'sc-substatus',
'sc-bytes', 'cs-bytes', 'time-taken', 'x-session', 'x-fullpath', 'x-debug']
df = pd.read_csv(filename, sep=' ', comment='#', engine='python', names=log_field)
print(df)
--------------------------------------------------------------------------------------------
... ... ... ...
104519 2019-09-09 ... -
104520 2019-09-09 ... -
104521 2019-09-09 ... -
104522 2019-09-09 ... -
104523 2019-09-09 ... -
[104524 rows x 21 columns]
'Python > Python for Windows' 카테고리의 다른 글
[Python] subprocess를 이용한 윈도우 방화벽 ON/OFF 점검 (0) | 2020.01.28 |
---|---|
[Python] subprocess모듈과 7z을 이용한 전일 로그 자동 압축 보관 (0) | 2019.10.24 |
[Python] subprocess모듈과 Bandizip을 이용한 전일 로그 자동 압축 보관 (0) | 2019.10.20 |
[Python] To send an attachment when mailing (0) | 2019.09.30 |
[Python] psutil을 이용한 프로세스/로컬IP/로컬Port/리모트IP/리모트Port 모니터링 (0) | 2019.09.08 |
[Python] Check ICMP using ping3 module, maria db and grafana (0) | 2019.08.25 |
[Python] winreg 모듈을 이용한 Windows 공유폴더 레지스트리 설정 점검 (0) | 2019.08.24 |
[Python] check ICMP using ping3 module. (파이썬을 이용한 ping 체크) (0) | 2019.08.19 |