Method CommonLog.read()
- Method
read
intread(function(array(int|string),int:void)callback,Stdio.File|stringlogfile,void|intoffset)- Description
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.
Array stringremote_hostint(0)|stringident_userint(0)|stringauth_userintyearintmonthintdayinthoursintminutesintsecondsinttimezoneint(0)|stringmethodOne of "GET", "POST", "HEAD" etc.
int(0)|stringpathstringprotocolE.g. "HTTP/1.0"
intreply_codeOne of 200, 404 etc.
intbytesThe second callback argument is the current offset to the end of the current line.
- Parameter
logfile The logfile to parse. Either an open Stdio.File object, or a string with the path to the logfile.
- Parameter
offset The absolute position in the file where the parser should begin. Note that the offset defaults to 0 (zero), NOT the current offset of
logfile.