Web server log which maintains a history of page requests, typically appended to the end of the file. Information about the request, including client IP address, request date/time, page requested, HTTP code, bytes served, user agent, and referrer are typically added.
Given a web server log records, find the total number of successful HTTL responses (200 code) for IP addresses with successful responses.
Input : Sample Access Log 192.168.1.2 - - [17/Sep/2013:22:18:19 -0700] "GET /abc HTTP/1.1" 404 201 192.168.1.2 - - [17/Sep/2013:22:18:19 -0700] "GET /favicon.ico HTTP/1.1" 200 1406 192.168.1.2 - - [17/Sep/2013:22:18:27 -0700] "GET /wp/ HTTP/1.1" 200 5325 192.168.1.2 - - [17/Sep/2013:22:18:27 -0700] "GET /wp/wp-content/themes/twentytwelve/style.css?ver=3.5.1 HTTP/1.1" 200 35292 192.168.1.3 - - [17/Sep/2013:22:18:27 -0700] "GET /wp/wp-content/themes/twentytwelve/js/navigation.js?ver=1.0 HTTP/1.1" 200 863 Output : 192.168.1.3 1 192.168.1.2 3
Prerequisite : Regular Expression in Java
126.96.36.199 1 188.8.131.52 1 184.108.40.206 3
- Java 8 | Consumer Interface in Java with Examples
- Java.lang.String.matches() in Java
- Java 8 | IntToLongFunction Interface in Java with Examples
- Java 8 | BiConsumer Interface in Java with Examples
- Min Heap in Java
- Hashing in Java
- SHA-512 Hash In Java
- MD2 Hash In Java
- SHA-224 Hash In Java
- SHA-384 Hash In Java
- Quantifiers in Java
- MD5 hash in Java
- Sorting in Java
- Implementing Checksum Using Java
- Java Swing | JMenuBar
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.