Reader for Apache Log Files

Share:

Description

This function reads a log file produced by an Apache web server from disk and returns a 'data.frame'.

Usage

1
2
## reader
read_access_log( file, format = c("common", "combined"), ... )

Arguments

file

a character string specifying the location of the log file on the local file system.

format

a character string specifying the log file format. Currently only "common" and "combined" are supported. See Details for more information.

...

further arguments passed to function read.table().

Details

The function read_access_log() reads all entries from log files produced by Apache web servers in one of two formats. The format "common" contains information about the client IP address, the RFC1413 identity, the userid determined by HTTP authentication, the timestamp of the request, the HTTP request, the HTTP status code, and the size of the object returned to the client (in bytes). Format "combined" additional includes information about the referer and the user agent.

Each column in the resulting 'data.frame' is of class 'character' except "Timestamp" which inherits from class 'chron' and columns "HTTP_status" and "User_agent" which are represented by a factor.

Value

A 'data.frame'.

Author(s)

Stefan Theussl

References

http://httpd.apache.org/docs/2.2/logs.html.

Examples

1
2
3
4
5
6
7
8
## read log entries in format "common":
common <- read_access_log( system.file("logs/common.log", package =
"alfa") )
common
## read log entries in format "combined":
combined <- read_access_log( system.file("logs/combined.log", package =
"alfa"), format = "combined" )
combined

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.