O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Log analysis with map

In this recipe, we will use map to analyze the access log for the Apache web server. The log contains access parameters for each host accessing the web server per line. The log looks like this:

    64.242.88.10 - - [07/Mar/2004:16:10:02 -0800] "GET     /mailman/listinfo/hsdivision HTTP/1.1" 200 6291
    64.242.88.10 - - [07/Mar/2004:16:11:58 -0800] "GET      /twiki/bin/view/TWiki/WikiSyntax HTTP/1.1" 200 7352
    64.242.88.10 - - [07/Mar/2004:16:20:55 -0800] "GET      /twiki/bin/view/Main/DCCAndPostFix HTTP/1.1" 200      5253

The line starts with hostname or IP that is accessing the web server. The remaining part of the line includes date and time, method of access (GET, PUT, POST, and so on), and the path of the web server being accessed. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required