1
希望有人可以用bash linux腳本來幫助我從http日誌生成報告。使用awk從apache http日誌生成報告
日誌格式:
domain.com 101.100.144.34 - r.c.bob [14/Feb/2017:11:31:20 +1100] "POST /webmail/json HTTP/1.1" 200 1883 "https://example.domain.com/webmail/index-rui.jsp?v=1479958955287" "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko" 1588 2566 "110.100.34.39" 9FC1CC8A6735D43EF75892667C08F9CE 84670 - - - -
輸出要求:
time in epoch,host,Resp Code,count
1485129842,101.100.144.34,200,4000
1485129842,101.101.144.34,404,1889
我有這麼遠,但沒有接近我所試圖實現:
tail -100 httpd_access_*.log | awk '{print $5 " " $2 " " $10}' | sort | uniq
日誌內容是否持續增長?在這種情況下,您可能想要禁用緩衝。 – Inian