-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathNginxCustomLogFormatReader.php
More file actions
45 lines (43 loc) · 1.23 KB
/
NginxCustomLogFormatReader.php
File metadata and controls
45 lines (43 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* ua-parser
*
* Copyright (c) 2011-2012 Dave Olsen, http://dmolsen.com
*
* Released under the MIT license
*/
namespace UAParser\Util\Logfile\Custom;
use UAParser\Util\Logfile\AbstractReader;
class NginxCustomLogFormatReader extends AbstractReader
{
protected function getRegex()
{
return '@^
\[(?:[^:]+):(?:\d+:\d+:\d+) \s+ (?:[^\]]+)\] # Date/time
\s+
(?:\S+)
\s+
(?:\S+) # IP
\s+
(?:\S+)
\s+
(?:\S+)
\s+
(?:\S+)
\s+
\"(?:\S+)\s(?:.*?) # Verb
\s+
(?:\S+)\" # Path
\s+
(?:\S+) # Response
\s+
(?:\S+) # Length
\s+
(?:\".*?\") # Referrer
\s+
\"(?P<userAgentString>.*?)\" # User Agent
\s+
\"(?:\S+)\"
$@x';
}
}