@@ -44,7 +44,7 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public static function getParser(string $logType, string $format = null, LogEntryFactoryInterface $factory = null): ?SoftwareLogParser |
| 46 | 46 | { |
| 47 | - switch ($logType){ |
|
| 47 | + switch ($logType) { |
|
| 48 | 48 | |
| 49 | 49 | case self::TYPE_APACHE_ACCESS: |
| 50 | 50 | return new \Kristuff\Parselog\Software\ApacheAccessLogParser($format, $factory); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @access protected |
| 55 | 55 | * @var array |
| 56 | 56 | */ |
| 57 | - protected $knownFormats = []; |
|
| 57 | + protected $knownFormats = [ ]; |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * The log files names |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @access protected |
| 63 | 63 | * @var array |
| 64 | 64 | */ |
| 65 | - protected $files = []; |
|
| 65 | + protected $files = [ ]; |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * The log files paths |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @access protected |
| 71 | 71 | * @var array |
| 72 | 72 | */ |
| 73 | - protected $paths = []; |
|
| 73 | + protected $paths = [ ]; |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * Constructor |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | protected function addFormat(string $name, string $format): void |
| 123 | 123 | { |
| 124 | - $this->knownFormats[$name] = $format; |
|
| 124 | + $this->knownFormats[ $name ] = $format; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | protected function addFile(string $fileName): void |
| 148 | 148 | { |
| 149 | - $this->files[] = $fileName; |
|
| 149 | + $this->files[ ] = $fileName; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | protected function addPath(string $path): void |
| 174 | 174 | { |
| 175 | - $this->paths[] = $path; |
|
| 175 | + $this->paths[ ] = $path; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -69,50 +69,50 @@ |
||
| 69 | 69 | $this->addFile('apache.log'); |
| 70 | 70 | $this->addFile('apache_access.log'); |
| 71 | 71 | |
| 72 | - $this->addFormat('apache_common', '%h %l %u %t \"%r\" %>s %O"'); |
|
| 73 | - $this->addFormat('apache_combined_vhost', '%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"'); |
|
| 74 | - $this->addFormat('apache_combined', '%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"'); |
|
| 75 | - $this->addFormat('apache_common_vhost', '%v %l %u %t \"%r\" %>s %b'); |
|
| 72 | + $this->addFormat('apache_common', '%h %l %u %t \"%r\" %>s %O"'); |
|
| 73 | + $this->addFormat('apache_combined_vhost', '%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"'); |
|
| 74 | + $this->addFormat('apache_combined', '%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"'); |
|
| 75 | + $this->addFormat('apache_common_vhost', '%v %l %u %t \"%r\" %>s %b'); |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | - $this->addNamedPattern('%%' , 'percent', '\%'); |
|
| 78 | + $this->addNamedPattern('%%', 'percent', '\%'); |
|
| 79 | 79 | |
| 80 | 80 | // time |
| 81 | - $this->addPattern('%t' , '\[(?P<time>\d{2}/(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/\d{4}:\d{2}:\d{2}:\d{2} (?:-|\+)\d{4})\]'); |
|
| 81 | + $this->addPattern('%t', '\[(?P<time>\d{2}/(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/\d{4}:\d{2}:\d{2}:\d{2} (?:-|\+)\d{4})\]'); |
|
| 82 | 82 | |
| 83 | - $this->addNamedPattern('%v' , 'serverName', '([a-zA-Z0-9]+)([a-z0-9.-]*)'); |
|
| 84 | - $this->addNamedPattern('%V' , 'canonicalServerName', '([a-zA-Z0-9]+)([a-z0-9.-]*)'); |
|
| 83 | + $this->addNamedPattern('%v', 'serverName', '([a-zA-Z0-9]+)([a-z0-9.-]*)'); |
|
| 84 | + $this->addNamedPattern('%V', 'canonicalServerName', '([a-zA-Z0-9]+)([a-z0-9.-]*)'); |
|
| 85 | 85 | |
| 86 | 86 | // port |
| 87 | - $this->addNamedPattern('%p' , 'port', '\d+'); |
|
| 87 | + $this->addNamedPattern('%p', 'port', '\d+'); |
|
| 88 | 88 | |
| 89 | 89 | // Client IP address of the request |
| 90 | - $this->addNamedPattern('%a', 'remoteIp', self::PATTERN_IP_ALL); |
|
| 90 | + $this->addNamedPattern('%a', 'remoteIp', self::PATTERN_IP_ALL); |
|
| 91 | 91 | |
| 92 | 92 | // Remote hostname |
| 93 | - $this->addNamedPattern('%h' , 'host', '[a-zA-Z0-9\-\._:]+'); |
|
| 93 | + $this->addNamedPattern('%h', 'host', '[a-zA-Z0-9\-\._:]+'); |
|
| 94 | 94 | |
| 95 | 95 | // Local IP-address |
| 96 | - $this->addNamedPattern('%A', 'localIp', self::PATTERN_IP_ALL); |
|
| 96 | + $this->addNamedPattern('%A', 'localIp', self::PATTERN_IP_ALL); |
|
| 97 | 97 | |
| 98 | 98 | // Remote user if the request was authenticated. May be bogus if return status (%s) is 401 (unauthorized). |
| 99 | - $this->addNamedPattern('%u', 'user', '(?:-|[\w\-\.]+)'); |
|
| 99 | + $this->addNamedPattern('%u', 'user', '(?:-|[\w\-\.]+)'); |
|
| 100 | 100 | |
| 101 | - $this->addNamedPattern('%l', 'logname', '(?:-|[\w-]+)'); |
|
| 102 | - $this->addNamedPattern('%m', 'requestMethod', 'OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT|PATCH|PROPFIND'); |
|
| 103 | - $this->addNamedPattern('%U', 'URL', '.+?'); |
|
| 101 | + $this->addNamedPattern('%l', 'logname', '(?:-|[\w-]+)'); |
|
| 102 | + $this->addNamedPattern('%m', 'requestMethod', 'OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT|PATCH|PROPFIND'); |
|
| 103 | + $this->addNamedPattern('%U', 'URL', '.+?'); |
|
| 104 | 104 | $this->addNamedPattern('%H', 'requestProtocol', 'HTTP/(1\.0|1\.1|2\.0)'); |
| 105 | - $this->addNamedPattern('%r', 'request', '(?:(?:[A-Z]+) .+? HTTP/(1\.0|1\.1|2\.0))|-|'); |
|
| 105 | + $this->addNamedPattern('%r', 'request', '(?:(?:[A-Z]+) .+? HTTP/(1\.0|1\.1|2\.0))|-|'); |
|
| 106 | 106 | |
| 107 | 107 | // Status of the final request |
| 108 | 108 | $this->addNamedPattern('%>s', 'status', '\d{3}|-'); |
| 109 | 109 | |
| 110 | 110 | // Bytes sent, including headers. May be zero in rare cases such as when a request is aborted before a |
| 111 | 111 | // response is sent. You need to enable mod_logio to use this. |
| 112 | - $this->addNamedPattern('%O', 'sentBytes', '[0-9]+'); |
|
| 112 | + $this->addNamedPattern('%O', 'sentBytes', '[0-9]+'); |
|
| 113 | 113 | |
| 114 | 114 | // Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent. |
| 115 | - $this->addNamedPattern('%b', 'responseBytes', '(\d+|-)'); |
|
| 115 | + $this->addNamedPattern('%b', 'responseBytes', '(\d+|-)'); |
|
| 116 | 116 | |
| 117 | 117 | //The time taken to serve the request, in seconds. |
| 118 | 118 | $this->addNamedPattern('%T', 'requestTime', '(\d+\.?\d*)'); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | const PATTERN_IP_V4 = '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]))'; |
| 33 | 33 | |
| 34 | 34 | /** IPV6 full pattern */ |
| 35 | - const PATTERN_IP_V6_FULL ='([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){7})'; // 1:1:1:1:1:1:1:1 |
|
| 35 | + const PATTERN_IP_V6_FULL = '([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){7})'; // 1:1:1:1:1:1:1:1 |
|
| 36 | 36 | |
| 37 | 37 | /** IPV6 null pattern */ |
| 38 | 38 | const PATTERN_IP_V6_NULL = '(::)'; |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $entry = new LogEntry(); |
| 34 | 34 | |
| 35 | 35 | foreach (array_filter(array_keys($data), 'is_string') as $key) { |
| 36 | - $entry->{$key} = trim($data[$key]); |
|
| 36 | + $entry->{$key} = trim($data[ $key ]); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return $entry; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $this->prettyName = 'Syslog'; |
| 44 | 44 | |
| 45 | 45 | $this->addFormat('default', '%t %h %s%p: %m'); |
| 46 | - $this->defaultFormat = '%t %h %s%p: %m'; |
|
| 46 | + $this->defaultFormat = '%t %h %s%p: %m'; |
|
| 47 | 47 | |
| 48 | 48 | $this->addPath("/var/log/"); |
| 49 | 49 | $this->addFile("syslog"); |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | $this->addFile("user"); |
| 57 | 57 | $this->addFile("messages"); |
| 58 | 58 | |
| 59 | - $this->addPattern('%t', '(?P<time>(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\s\d|\d{2}) \d{2}:\d{2}:\d{2})'); |
|
| 60 | - $this->addPattern('%h', '(?P<hostname>.+?)'); |
|
| 61 | - $this->addPattern('%s', '(?P<service>[^\[:]+)'); |
|
| 62 | - $this->addPattern('%p', '(\[(?P<pid>\d+)\])?'); |
|
| 63 | - $this->addPattern('%m', '(?P<message>.+)'); |
|
| 59 | + $this->addPattern('%t', '(?P<time>(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\s\d|\d{2}) \d{2}:\d{2}:\d{2})'); |
|
| 60 | + $this->addPattern('%h', '(?P<hostname>.+?)'); |
|
| 61 | + $this->addPattern('%s', '(?P<service>[^\[:]+)'); |
|
| 62 | + $this->addPattern('%p', '(\[(?P<pid>\d+)\])?'); |
|
| 63 | + $this->addPattern('%m', '(?P<message>.+)'); |
|
| 64 | 64 | |
| 65 | 65 | parent::__construct($format, $factory); |
| 66 | 66 | } |
@@ -41,8 +41,8 @@ |
||
| 41 | 41 | $this->software = 'Fail2ban'; |
| 42 | 42 | $this->prettyName = 'Fail2ban'; |
| 43 | 43 | $this->addFormat('default', '%t %s %p %l %j %m'); |
| 44 | - $this->defaultFormat = '%t %s %p %l %j %m'; |
|
| 45 | - $this->timeFormat = 'Y-m-d'; |
|
| 44 | + $this->defaultFormat = '%t %s %p %l %j %m'; |
|
| 45 | + $this->timeFormat = 'Y-m-d'; |
|
| 46 | 46 | |
| 47 | 47 | $this->addPath("/var/log/"); |
| 48 | 48 | $this->addFile("fail2ban.log"); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @access protected |
| 52 | 52 | * @var array |
| 53 | 53 | */ |
| 54 | - protected $patterns = []; |
|
| 54 | + protected $patterns = [ ]; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * The time format |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public function addNamedPattern(string $placeholder, string $propertyName, string $pattern, bool $required = true): void |
| 92 | 92 | { |
| 93 | 93 | // First field must be a required field |
| 94 | - if ($required === false && count($this->patterns) === 0){ |
|
| 94 | + if ($required === false && count($this->patterns) === 0) { |
|
| 95 | 95 | throw new \Kristuff\Parselog\InvalidArgumentException( |
| 96 | 96 | "Invalid value 'false' for argument 'required' given: First pattern must be a required pattern."); |
| 97 | 97 | } |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | // Adjust pattern for nullable columns and add space before placeholder |
| 101 | 101 | // - $format = '%t %l %P %E: %a %M'; |
| 102 | 102 | // + $format = '%t %l( %P)?( %E:)?(%a)? %M'; |
| 103 | - $key = $required ? $placeholder : ' ' . $placeholder ; |
|
| 104 | - $val = '(?P<'. $propertyName . '>' . ($required ? $pattern : '( ' . $pattern . ')?') . ')'; |
|
| 103 | + $key = $required ? $placeholder : ' '.$placeholder; |
|
| 104 | + $val = '(?P<'.$propertyName.'>'.($required ? $pattern : '( '.$pattern.')?').')'; |
|
| 105 | 105 | |
| 106 | 106 | $this->addPattern($key, $val); |
| 107 | 107 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function addPattern(string $placeholder, string $pattern): void |
| 120 | 120 | { |
| 121 | - $this->patterns[$placeholder] = $pattern; |
|
| 121 | + $this->patterns[ $placeholder ] = $pattern; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $format = str_replace("\\", '', $format); |
| 149 | 149 | |
| 150 | 150 | // store log format update IP pattern |
| 151 | - $this->logFormat = $format ; |
|
| 151 | + $this->logFormat = $format; |
|
| 152 | 152 | $this->updateIpPatterns(); |
| 153 | 153 | |
| 154 | 154 | // strtr won't work for "complex" header patterns |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | protected function getTimestamp($time): ?int |
| 209 | 209 | { |
| 210 | 210 | // try to get stamp from string |
| 211 | - if (isset($this->timeFormat)){ |
|
| 211 | + if (isset($this->timeFormat)) { |
|
| 212 | 212 | $dateTime = DateTime::createFromFormat($this->timeFormat, $time); |
| 213 | 213 | |
| 214 | 214 | if (false !== $dateTime) { |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | // Set IPv4 & IPv6 recognition patterns |
| 237 | 237 | $ipPatterns = implode('|', [ |
| 238 | 238 | 'ipv4' => self::PATTERN_IP_V4, |
| 239 | - 'ipv6full' => self::PATTERN_IP_V6_FULL, // 1:1:1:1:1:1:1:1 |
|
| 240 | - 'ipv6null' => self::PATTERN_IP_V6_NULL, // :: |
|
| 241 | - 'ipv6leading' => self::PATTERN_IP_V6_LEADING, // ::1:1:1:1:1:1:1 |
|
| 242 | - 'ipv6mid' => self::PATTERN_IP_V6_MID, // 1:1:1::1:1:1 |
|
| 243 | - 'ipv6trailing' => self::PATTERN_IP_V6_TRAILING, // 1:1:1:1:1:1:1:: |
|
| 239 | + 'ipv6full' => self::PATTERN_IP_V6_FULL, // 1:1:1:1:1:1:1:1 |
|
| 240 | + 'ipv6null' => self::PATTERN_IP_V6_NULL, // :: |
|
| 241 | + 'ipv6leading' => self::PATTERN_IP_V6_LEADING, // ::1:1:1:1:1:1:1 |
|
| 242 | + 'ipv6mid' => self::PATTERN_IP_V6_MID, // 1:1:1::1:1:1 |
|
| 243 | + 'ipv6trailing' => self::PATTERN_IP_V6_TRAILING, // 1:1:1:1:1:1:1:: |
|
| 244 | 244 | ]); |
| 245 | 245 | |
| 246 | 246 | foreach ($this->patterns as &$value) { |
@@ -154,23 +154,23 @@ discard block |
||
| 154 | 154 | // set 2.2 format by default. Will be changed to 2.4 format, ie: |
| 155 | 155 | // $this->timeFormat = 'D M d H:i:s.u Y'; |
| 156 | 156 | // , if the format contain %{u} insted of %t |
| 157 | - $this->timeFormat = 'D M d H:i:s Y'; |
|
| 157 | + $this->timeFormat = 'D M d H:i:s Y'; |
|
| 158 | 158 | |
| 159 | - $this->addFormat('default', self::FORMAT_APACHE_2_4_DEFAULT); |
|
| 160 | - $this->addFormat('apache2.2 default', self::FORMAT_APACHE_2_2_DEFAULT); |
|
| 161 | - $this->addFormat('apache2.2 extented', self::FORMAT_APACHE_2_2_EXTENDED); |
|
| 162 | - $this->addFormat('apache2.2 referer', self::FORMAT_APACHE_2_2_REFERER); |
|
| 163 | - $this->addFormat('apache2.2 extented referer', self::FORMAT_APACHE_2_2_EXTENDED_REFERER); |
|
| 164 | - $this->addFormat('apache2.4 default', self::FORMAT_APACHE_2_4_DEFAULT); |
|
| 165 | - $this->addFormat('apache2.4 extented', self::FORMAT_APACHE_2_4_EXTENDED); |
|
| 166 | - $this->addFormat('apache2.4 referer', self::FORMAT_APACHE_2_4_REFEFER); |
|
| 167 | - $this->addFormat('apache2.4 extented referer', self::FORMAT_APACHE_2_4_EXTENDED_REFERER); |
|
| 168 | - $this->addFormat('apache2.4 npm', self::FORMAT_APACHE_2_4_MPM); |
|
| 169 | - $this->addFormat('apache2.4 npm extented', self::FORMAT_APACHE_2_4_MPM_EXTENDED); |
|
| 170 | - $this->addFormat('apache2.4 npm referer', self::FORMAT_APACHE_2_4_MPM_REFERER); |
|
| 159 | + $this->addFormat('default', self::FORMAT_APACHE_2_4_DEFAULT); |
|
| 160 | + $this->addFormat('apache2.2 default', self::FORMAT_APACHE_2_2_DEFAULT); |
|
| 161 | + $this->addFormat('apache2.2 extented', self::FORMAT_APACHE_2_2_EXTENDED); |
|
| 162 | + $this->addFormat('apache2.2 referer', self::FORMAT_APACHE_2_2_REFERER); |
|
| 163 | + $this->addFormat('apache2.2 extented referer', self::FORMAT_APACHE_2_2_EXTENDED_REFERER); |
|
| 164 | + $this->addFormat('apache2.4 default', self::FORMAT_APACHE_2_4_DEFAULT); |
|
| 165 | + $this->addFormat('apache2.4 extented', self::FORMAT_APACHE_2_4_EXTENDED); |
|
| 166 | + $this->addFormat('apache2.4 referer', self::FORMAT_APACHE_2_4_REFEFER); |
|
| 167 | + $this->addFormat('apache2.4 extented referer', self::FORMAT_APACHE_2_4_EXTENDED_REFERER); |
|
| 168 | + $this->addFormat('apache2.4 npm', self::FORMAT_APACHE_2_4_MPM); |
|
| 169 | + $this->addFormat('apache2.4 npm extented', self::FORMAT_APACHE_2_4_MPM_EXTENDED); |
|
| 170 | + $this->addFormat('apache2.4 npm referer', self::FORMAT_APACHE_2_4_MPM_REFERER); |
|
| 171 | 171 | $this->addFormat('apache2.4 npm extented referer ', self::FORMAT_APACHE_2_4_MPM_EXTENDED_REFERER); |
| 172 | - $this->addFormat('apache2.4 npm tid', self::FORMAT_APACHE_2_4_MPM_TID); |
|
| 173 | - $this->addFormat('apache2.4 npm tid referer', self::FORMAT_APACHE_2_4_MPM_TID_REFERER); |
|
| 172 | + $this->addFormat('apache2.4 npm tid', self::FORMAT_APACHE_2_4_MPM_TID); |
|
| 173 | + $this->addFormat('apache2.4 npm tid referer', self::FORMAT_APACHE_2_4_MPM_TID_REFERER); |
|
| 174 | 174 | |
| 175 | 175 | $this->addPath("/var/log/"); |
| 176 | 176 | $this->addPath("/var/log/apache/"); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | // define patterns |
| 193 | 193 | // *************** |
| 194 | 194 | |
| 195 | - $this->addNamedPattern('%%' , 'percent', '\%'); |
|
| 195 | + $this->addNamedPattern('%%', 'percent', '\%'); |
|
| 196 | 196 | |
| 197 | 197 | // %t The current time |
| 198 | 198 | // %{u}t The current time including micro-seconds |
@@ -203,29 +203,29 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | // %a Client IP address and port of the request (port is not registered by parser). |
| 205 | 205 | // That column may be missing depending of error |
| 206 | - $clientIpPattern = '( \[client (?P<remoteIp>' . self::PATTERN_IP_ALL . ')(:[\d]+|)?\])?'; |
|
| 207 | - $this->addPattern(' \[client %a\]' , $clientIpPattern); |
|
| 208 | - $this->addPattern(' \[%a\]' , $clientIpPattern); |
|
| 209 | - $this->addPattern(' %a' , $clientIpPattern); |
|
| 206 | + $clientIpPattern = '( \[client (?P<remoteIp>'.self::PATTERN_IP_ALL.')(:[\d]+|)?\])?'; |
|
| 207 | + $this->addPattern(' \[client %a\]', $clientIpPattern); |
|
| 208 | + $this->addPattern(' \[%a\]', $clientIpPattern); |
|
| 209 | + $this->addPattern(' %a', $clientIpPattern); |
|
| 210 | 210 | |
| 211 | 211 | // %A Local IP-address and port |
| 212 | 212 | // That column may be missing depending of error |
| 213 | - $this->addNamedPattern('%A', 'localIP', self::PATTERN_IP_ALL, false); |
|
| 213 | + $this->addNamedPattern('%A', 'localIP', self::PATTERN_IP_ALL, false); |
|
| 214 | 214 | |
| 215 | 215 | // %m Name of the module logging the message |
| 216 | 216 | // %l Loglevel of the message |
| 217 | - $this->addPattern('\[%m:%l\]', '\[(?<module>.+?)?:(?P<level>[\w]+)\]'); |
|
| 217 | + $this->addPattern('\[%m:%l\]', '\[(?<module>.+?)?:(?P<level>[\w]+)\]'); |
|
| 218 | 218 | $this->addPattern('\[%-m:%l\]', '\[(?<module>.+?)?:(?P<level>[\w]+)\]'); |
| 219 | - $this->addPattern('\[%l\]', '\[(?P<level>[\w:]+)\]'); |
|
| 220 | - $this->addPattern('%l', '\[(?P<level>[\w:]+)\]'); |
|
| 219 | + $this->addPattern('\[%l\]', '\[(?P<level>[\w:]+)\]'); |
|
| 220 | + $this->addPattern('%l', '\[(?P<level>[\w:]+)\]'); |
|
| 221 | 221 | |
| 222 | 222 | // %P Process ID of current process (since apache 2.4?) |
| 223 | 223 | // %T Thread ID of current thread |
| 224 | 224 | $this->addPattern('\[pid %P:tid %T\]', '\[pid (?P<pid>\d+):tid (?P<tid>\d+)\]'); |
| 225 | - $this->addPattern('%P %T', '\[pid (?P<pid>\d+):tid (?P<tid>\d+)\]'); |
|
| 225 | + $this->addPattern('%P %T', '\[pid (?P<pid>\d+):tid (?P<tid>\d+)\]'); |
|
| 226 | 226 | $this->addPattern('\[pid %P\]', '\[pid (?P<pid>\d+)\]'); |
| 227 | - $this->addPattern('\[%P\]', '\[pid (?P<pid>\d+)\]'); |
|
| 228 | - $this->addPattern('%P', '\[pid (?P<pid>\d+)\]'); |
|
| 227 | + $this->addPattern('\[%P\]', '\[pid (?P<pid>\d+)\]'); |
|
| 228 | + $this->addPattern('%P', '\[pid (?P<pid>\d+)\]'); |
|
| 229 | 229 | |
| 230 | 230 | // %E APR/OS error status code and string |
| 231 | 231 | // That column may be missing depending of error |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | $this->addPattern(' %F:', '( (?P<fileName>[^ ]+\([\d]+\)):)?'); |
| 237 | 237 | |
| 238 | 238 | // %M The actual log message |
| 239 | - $this->addNamedPattern('%M', 'message', '.+?'); |
|
| 239 | + $this->addNamedPattern('%M', 'message', '.+?'); |
|
| 240 | 240 | |
| 241 | 241 | // referer (may be empty) |
| 242 | - $this->addPattern(' , referer %{Referer}i', '(, referer: (?P<referer>[^ ]+))?'); |
|
| 243 | - $this->addPattern(', referer %{Referer}i', '(, referer: (?P<referer>[^ ]+))?'); |
|
| 242 | + $this->addPattern(' , referer %{Referer}i', '(, referer: (?P<referer>[^ ]+))?'); |
|
| 243 | + $this->addPattern(', referer %{Referer}i', '(, referer: (?P<referer>[^ ]+))?'); |
|
| 244 | 244 | |
| 245 | 245 | // now let default constructor |
| 246 | 246 | parent::__construct($format, $factory); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | parent::setFormat($format); |
| 260 | 260 | |
| 261 | 261 | // set the correct time format |
| 262 | - if (strpos($this->logFormat, '%{u}t') !== false){ |
|
| 262 | + if (strpos($this->logFormat, '%{u}t') !== false) { |
|
| 263 | 263 | $this->timeFormat = 'D M d H:i:s.u Y'; |
| 264 | 264 | } |
| 265 | 265 | } |