Exercise
Now try to apply what you have learned into extracting the following data, from the logfile below:
- All Ip-addresses
- Filenames if the responsecode isn’t 200
- Total filesize of the 200 requests
First make sure that you understand the format of this Apache logfile. Then you can start digging into the data.
193.106.31.130 - - [23/Sep/2020:11:57:15 +0200] "POST /administrator/index.php HTTP/1.0" 200 4481 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)" "-"
3.120.223.25 - - [23/Sep/2020:11:59:42 +0200] "GET /apache-log/access.log HTTP/1.1" 200 20899424 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
3.121.24.234 - - [23/Sep/2020:11:59:42 +0200] "GET /apache-log/access.log HTTP/1.1" 200 9763544 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Mobile Safari/537.36" "-"
3.121.24.234 - - [23/Sep/2020:11:59:43 +0200] "GET /apache-log/access.log HTTP/1.1" 200 14853136 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 7 Build/KRT16M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
37.170.98.124 - - [23/Sep/2020:12:04:23 +0200] "GET /apache-log/access.log HTTP/1.1" 200 1219290675 "https://www.google.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0" "-"
157.55.39.21 - - [23/Sep/2020:12:07:00 +0200] "GET /robots.txt HTTP/1.1" 200 304 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" "-"
3.120.223.25 - - [23/Sep/2020:12:14:40 +0200] "GET /apache-log/access.log HTTP/1.1" 200 12050672 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Mobile Safari/537.36" "-"
3.120.223.25 - - [23/Sep/2020:12:14:41 +0200] "GET /apache-log/access.log HTTP/1.1" 200 29412072 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
3.120.223.25 - - [23/Sep/2020:12:14:41 +0200] "GET /apache-log/access.log HTTP/1.1" 200 15149096 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 7 Build/KRT16M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
40.77.167.156 - - [23/Sep/2020:12:16:30 +0200] "GET /apache-log/access.log:80 HTTP/1.1" 404 230 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" "-"
18.195.155.52 - - [23/Sep/2020:12:29:40 +0200] "GET /apache-log/access.log HTTP/1.1" 200 18831288 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
3.121.24.234 - - [23/Sep/2020:12:29:41 +0200] "GET /apache-log/access.log HTTP/1.1" 200 9698360 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Mobile Safari/537.36" "-"
3.120.223.25 - - [23/Sep/2020:12:29:41 +0200] "GET /apache-log/access.log HTTP/1.3" 400 17035456 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 7 Build/KRT16M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
111.119.187.30 - - [23/Sep/2020:12:34:27 +0200] "GET /server.php HTTP/1.1" 401 230 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36" "-"
111.119.187.30 - - [23/Sep/2020:12:35:06 +0200] "GET /apache-log/access.log HTTP/1.1" 200 5099992 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36" "-"
111.119.187.30 - - [23/Sep/2020:12:36:11 +0200] "GET /apache-log/access.log HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36" "-"
185.153.46.94 - - [23/Sep/2020:12:44:16 +0200] "GET /apache-log/access.log HTTP/1.1" 200 10891488 "-" "python-requests/2.24.0" "-"
18.195.155.52 - - [23/Sep/2020:12:44:39 +0200] "GET /apache-log/access.log HTTP/1.1" 200 18894616 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
3.121.24.234 - - [23/Sep/2020:12:44:41 +0200] "GET /admin.php HTTP/1.1" 401 16233064 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 7 Build/KRT16M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
3.120.223.25 - - [23/Sep/2020:12:44:42 +0200] "GET /apache-log/access.log HTTP/1.1" 200 10560928 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Mobile Safari/537.36" "-"
3.121.24.234 - - [23/Sep/2020:12:59:40 +0200] "GET /apache-log/access.log HTTP/1.1" 200 18148896 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
18.195.155.52 - - [23/Sep/2020:12:59:40 +0200] "GET /apache-log/access.log HTTP/1.1" 200 18072776 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 7 Build/KRT16M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
3.120.223.25 - - [23/Sep/2020:12:59:40 +0200] "GET /apache-log/access.log HTTP/1.1" 200 9004248 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Mobile Safari/537.36" "-"
185.153.46.94 - - [23/Sep/2020:13:07:26 +0200] "GET /apache-log/access.log HTTP/1.1" 200 145984 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36" "-"
18.195.155.52 - - [23/Sep/2020:13:14:41 +0200] "GET /apache-log/error.log HTTP/1.1" 404 230 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
18.195.155.52 - - [23/Sep/2020:13:14:41 +0200] "GET /apache-log/access.log HTTP/1.1" 200 17451152 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 7 Build/KRT16M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36" "-"
3.120.223.25 - - [23/Sep/2020:13:14:45 +0200] "GET /apache-log/access.log HTTP/1.1" 200 10061336 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Mobile Safari/537.36" "-"
185.103.121.10 - - [23/Sep/2020:13:19:47 +0200] "GET /apache-log/access.log HTTP/1.1" 200 26709316 "https://www.google.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36" "-"