Method read

int read(function(array(int|string), int:void) callback, Stdio.File|string logfile, void|int offset)


Reads the log file and calls the callback function for every parsed line. For lines that fails to be parsed the callback is not called not is any error thrown. The number of bytes read are returned.

Parameter callback

The callbacks first argument is an array with the different parts of the log entry.

string remote_host 
int(0..0)|string ident_user 
int(0..0)|string auth_user 
int year 
int month 
int day 
int hours 
int minutes 
int seconds 
int timezone 
int(0..0)|string method

One of "GET", "POST", "HEAD" etc.

int(0..0)|string path 
string protocol

E.g. "HTTP/1.0"

int reply_code

One of 200, 404 etc.

int bytes 

The second callback argument is the current offset to the end of the current line.

Parameter offset

The position in the file where the parser should begin.