Methods

Creates the ApacheLogFile instance

__construct(string $logFile, string $format) : null

Parameters

$logFile

string

The log to parse

$format

string

The Apache CustomLog/LogFormat for the log file

Returns

null

Gets a specified ApacheLogRecord or the entire array of them

getRow(int $row) : \apacheLogParser\array[int]ApacheLogRecord | \apacheLogParser\ApacheLogRecord

If this is the first time calling it, the log will be parsed before returning a record.

Parameters

$row

int

[Optional] Default = -1 If -1, returns all records in an array

Returns

\apacheLogParser\array[int]ApacheLogRecord\apacheLogParser\ApacheLogRecord

Parses the Apache log format into a regular expression

_convertFormatToRegEx() : string

Returns

string

Parses the log file using a regular expression generated from $this->format

_parseLog() : void

Turns a specific Apache log directive element into a regular expression

_processApacheLogCommand(string $command, string $segment) : string

todo This is not complete, there are a number of directives that should be made more accurate or that haven't been created yet
todo This doesn't handle < or > modifiers except for the %...s directive

Parameters

$command

string

$segment

string

Returns

string

 Properties

 

The file contents of the log file

$file : string

 

The Apache CustomLog/LogFormat for the log file

$format : string

see \apacheLogParser\https://httpd.apache.org/docs/2.0/mod/mod_log_config.html
 

The expected pieces of the log parsed from $format

$logPieces : \apacheLogParser\array[int]string

 

The parsed out log entries

$rows : \apacheLogParser\array[int]ApacheLogRecord