Method CommonLog.read()
- Method
read
int
read(function
(array
(int
|string
),int
:void
)callback
,Stdio.File
|string
logfile
,void
|int
offset
)- 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 string
remote_host
int(0)
|string
ident_user
int(0)
|string
auth_user
int
year
int
month
int
day
int
hours
int
minutes
int
seconds
int
timezone
int(0)
|string
method
One of "GET", "POST", "HEAD" etc.
int(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
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
.