-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformat.go
54 lines (48 loc) · 867 Bytes
/
format.go
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
46
47
48
49
50
51
52
53
54
package apachelogparser
import (
"net"
"time"
)
const (
StandardEnglishFormat string = "02/Jan/2006:15:04:05 -0700"
sizeCommonLog = 10
sizeCombinedLog = 7
separator = " "
)
//position of the log entry
const (
IP = iota
Identity
User
Timestamp
TZ
Method
Resource
Protocol
Status
Size
Referer
UserAgent
)
// Example "GET /apache_pb.gif HTTP/1.0"
type request struct {
Method string
Resource string //path
Protocol string
}
// LogFormat "%h %l %u %t \"%r\" %>s %b" common
type CommonLog struct {
IP net.IP
Identity string
User string
Timestamp time.Time
Request request
Status int
Size int64
}
// LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
type CombinedLog struct {
Common CommonLog
Referer string
UserAgent string
}