Documentation
¶
Index ¶
- Constants
- Variables
- type AccessLog
- func (this *AccessLog) CleanFields()
- func (this *AccessLog) DBColumns() maps.Map
- func (this *AccessLog) Format(format string) string
- func (this *AccessLog) GetHeader(name string) string
- func (v AccessLog) MarshalEasyJSON(w *jwriter.Writer)
- func (v AccessLog) MarshalJSON() ([]byte, error)
- func (this *AccessLog) Parse()
- func (this *AccessLog) SentContentType() string
- func (this *AccessLog) SetDBColumns(v maps.Map)
- func (this *AccessLog) SetShouldStat(b bool)
- func (this *AccessLog) SetShouldWrite(b bool)
- func (this *AccessLog) SetWritingFields(fields []int)
- func (this *AccessLog) ShouldStat() bool
- func (this *AccessLog) ShouldWrite() bool
- func (this *AccessLog) Time() time.Time
- func (v *AccessLog) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *AccessLog) UnmarshalJSON(data []byte) error
- type AccessLogClient
- type AccessLogClientBrowser
- type AccessLogClientDevice
- type AccessLogClientOS
- type AccessLogExtend
- type AccessLogField
- type AccessLogFile
- type AccessLogGeo
- type AccessLogGeoLocation
Constants ¶
const ( AccessLogFieldHeader = 1 AccessLogFieldSentHeader = 2 AccessLogFieldArg = 3 AccessLogFieldCookie = 4 AccessLogFieldExtend = 5 AccessLogFieldReferer = 6 AccessLogFieldUserAgent = 7 AccessLogFieldRequestBody = 8 AccessLogFieldResponseBody = 9 )
Variables ¶
var AccessLogDefaultFieldsCodes = []int{ AccessLogFieldHeader, AccessLogFieldSentHeader, AccessLogFieldArg, AccessLogFieldCookie, AccessLogFieldExtend, AccessLogFieldReferer, AccessLogFieldUserAgent, }
var AccessLogFields = []maps.Map{ { "code": AccessLogFieldHeader, "name": "请求Header列表", }, { "code": AccessLogFieldSentHeader, "name": "响应Header列表", }, { "code": AccessLogFieldArg, "name": "参数列表", }, { "code": AccessLogFieldCookie, "name": "Cookie列表", }, { "code": AccessLogFieldExtend, "name": "位置和浏览器分析", }, { "code": AccessLogFieldReferer, "name": "请求来源", }, { "code": AccessLogFieldUserAgent, "name": "终端信息", }, { "code": AccessLogFieldRequestBody, "name": "请求Body", }, { "code": AccessLogFieldResponseBody, "name": "响应Body", }, }
Functions ¶
This section is empty.
Types ¶
type AccessLog ¶
type AccessLog struct {
Id shared.ObjectId `var:"id" bson:"_id" json:"id"` // 数据库存储的ID
ServerId string `var:"serverId" bson:"serverId" json:"serverId"` // 服务ID
BackendId string `var:"backendId" bson:"backendId" json:"backendId"` // 后端服务ID
LocationId string `var:"locationId" bson:"locationId" json:"locationId"` // 路径配置ID
FastcgiId string `var:"fastcgiId" bson:"fastcgiId" json:"fastcgiId"` // Fastcgi配置ID
RewriteId string `var:"rewriteId" bson:"rewriteId" json:"rewriteId"` // 重写规则ID
TeaVersion string `var:"teaVersion" bson:"teaVersion" json:"teaVersion"` // TeaWeb版本
RemoteAddr string `var:"remoteAddr" bson:"remoteAddr" json:"remoteAddr"` // 终端地址,通常是:ip:port
RemotePort int `var:"remotePort" bson:"remotePort" json:"remotePort"` // 终端端口
RemoteUser string `var:"remoteUser" bson:"remoteUser" json:"remoteUser"` // 终端用户,基于BasicAuth认证
RequestURI string `var:"requestURI" bson:"requestURI" json:"requestURI"` // 请求URI
RequestPath string `var:"requestPath" bson:"requestPath" json:"requestPath"` // 请求URI中的路径
APIPath string `var:"apiPath" bson:"apiPath" json:"apiPath"` // API路径
APIStatus string `var:"apiStatus" bson:"apiStatus" json:"apiStatus"` // API状态码
RequestLength int64 `var:"requestLength" bson:"requestLength" json:"requestLength"` // 请求内容长度
RequestTime float64 `var:"requestTime" bson:"requestTime" json:"requestTime"` // 从请求到所有响应数据发送到请求端所花时间,单位为带有小数点的秒,精确到纳秒,比如:0.000260081
RequestMethod string `var:"requestMethod" bson:"requestMethod" json:"requestMethod"` // 请求方法
RequestFilename string `var:"requestFilename" bson:"requestFilename" json:"requestFilename"` // 请求的文件名,包含完整的路径
Scheme string `var:"scheme" bson:"scheme" json:"scheme"` // 请求协议,http或者https
Proto string `var:"proto" bson:"proto" json:"proto"` // 请求协议,比如HTTP/1.0, HTTP/1.1
BytesSent int64 `var:"bytesSent" bson:"bytesSent" json:"bytesSent"` // 响应的字节数,目前同 bodyBytesSent
BodyBytesSent int64 `var:"bodyBytesSent" bson:"bodyBytesSent" json:"bodyBytesSent"` // 响应的字节数
Status int `var:"status" bson:"status" json:"status"` // 响应的状态码
StatusMessage string `var:"statusMessage" bson:"statusMessage" json:"statusMessage"` // 响应的信息
SentHeader map[string][]string `var:"sentHeader" bson:"sentHeader" json:"sentHeader"` // 响应的头信息
TimeISO8601 string `var:"timeISO8601" bson:"timeISO8601" json:"timeISO8601"` // ISO 8601格式的本地时间,比如 2018-07-16T23:52:24.839+08:00
TimeLocal string `var:"timeLocal" bson:"timeLocal" json:"timeLocal"` // 本地时间,比如 17/Jul/2018:09:52:24 +0800
Msec float64 `var:"msec" bson:"msec" json:"msec"` // 带有毫秒的时间,比如 1531756823.054
Timestamp int64 `var:"timestamp" bson:"timestamp" json:"timestamp"` // unix时间戳,单位为秒
Host string `var:"host" bson:"host" json:"host"` // 主机名
Referer string `var:"referer" bson:"referer" json:"referer"` // 请求来源URL
UserAgent string `var:"userAgent" bson:"userAgent" json:"userAgent"` // 客户端信息
Request string `var:"request" bson:"request" json:"request"` // 请求的简要说明,格式类似于 GET /hello/world HTTP/1.1
ContentType string `var:"contentType" bson:"contentType" json:"contentType"` // 请求头部的Content-Type
Cookie map[string]string `bson:"cookie" json:"cookie"` // Cookie cookie.name, cookie.sid
Arg map[string][]string `bson:"arg" json:"arg"` // arg_name, arg_id
Args string `var:"args" bson:"args" json:"args"` // name=liu&age=20
QueryString string `var:"queryString" bson:"queryString" json:"queryString"` // 同 Args
Header map[string][]string `bson:"header" json:"header"` // 请求的头部信息,支持header_*和http_*,header_content_type, header_expires, http_content_type, http_user_agent
ServerName string `var:"serverName" bson:"serverName" json:"serverName"` // 接收请求的服务器名
ServerPort int `var:"serverPort" bson:"serverPort" json:"serverPort"` // 服务器端口
ServerProtocol string `var:"serverProtocol" bson:"serverProtocol" json:"serverProtocol"` // 服务器协议,类似于HTTP/1.0”
// 代理相关
BackendAddress string `var:"backendAddress" bson:"backendAddress" json:"backendAddress"` // 代理的后端的地址
FastcgiAddress string `var:"fastcgiAddress" bson:"fastcgiAddress" json:"fastcgiAddress"` // Fastcgi后端地址
// 调试用
RequestData []byte `var:"" bson:"requestData" json:"requestData"` // 请求数据
ResponseHeaderData []byte `var:"" bson:"responseHeaderData" json:"responseHeaderData"` // 响应Header数据
ResponseBodyData []byte `var:"" bson:"responseBodyData" json:"responseBodyData"` // 响应Body数据
// 错误信息
Errors []string `var:"errors" bson:"errors" json:"errors"` // 错误信息
HasErrors bool `var:"hasErrors" bson:"hasErrors" json:"hasErrors"` // 是否包含有错误信息
// 扩展
Extend *AccessLogExtend `bson:"extend" json:"extend"`
Attrs map[string]string `bson:"attrs" json:"attrs"`
// 日志
StorageOnly bool `bson:"storageOnly" json:"storageOnly"` // 是否只存储到日志策略中
StoragePolicyIds []string `bson:"storagePolicyIds" json:"storagePolicyIds"` // 日志策略Ids
// contains filtered or unexported fields
}
func (AccessLog) MarshalEasyJSON ¶ added in v0.1.8
MarshalEasyJSON supports easyjson.Marshaler interface
func (AccessLog) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*AccessLog) SentContentType ¶
func (*AccessLog) SetDBColumns ¶ added in v0.1.8
设置数据库列值
func (*AccessLog) UnmarshalEasyJSON ¶ added in v0.1.8
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AccessLog) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type AccessLogClient ¶
type AccessLogClient struct {
OS AccessLogClientOS `bson:"os" json:"os"`
Device AccessLogClientDevice `bson:"device" json:"device"`
Browser AccessLogClientBrowser `bson:"browser" json:"browser"`
}
func (AccessLogClient) MarshalEasyJSON ¶ added in v0.1.8
func (v AccessLogClient) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AccessLogClient) MarshalJSON ¶
func (v AccessLogClient) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AccessLogClient) UnmarshalEasyJSON ¶ added in v0.1.8
func (v *AccessLogClient) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AccessLogClient) UnmarshalJSON ¶
func (v *AccessLogClient) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type AccessLogClientBrowser ¶
type AccessLogClientBrowser struct {
Family string `bson:"family" json:"family"`
Major string `bson:"major" json:"major"`
Minor string `bson:"minor" json:"minor"`
Patch string `bson:"patch" json:"patch"`
}
func (AccessLogClientBrowser) MarshalEasyJSON ¶ added in v0.1.8
func (v AccessLogClientBrowser) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AccessLogClientBrowser) MarshalJSON ¶
func (v AccessLogClientBrowser) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AccessLogClientBrowser) UnmarshalEasyJSON ¶ added in v0.1.8
func (v *AccessLogClientBrowser) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AccessLogClientBrowser) UnmarshalJSON ¶
func (v *AccessLogClientBrowser) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type AccessLogClientDevice ¶
type AccessLogClientDevice struct {
Family string `bson:"family" json:"family"`
Brand string `bson:"brand" json:"brand"`
Model string `bson:"model" json:"model"`
}
func (AccessLogClientDevice) MarshalEasyJSON ¶ added in v0.1.8
func (v AccessLogClientDevice) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AccessLogClientDevice) MarshalJSON ¶
func (v AccessLogClientDevice) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AccessLogClientDevice) UnmarshalEasyJSON ¶ added in v0.1.8
func (v *AccessLogClientDevice) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AccessLogClientDevice) UnmarshalJSON ¶
func (v *AccessLogClientDevice) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type AccessLogClientOS ¶
type AccessLogClientOS struct {
Family string `bson:"family" json:"family"`
Major string `bson:"major" json:"major"`
Minor string `bson:"minor" json:"minor"`
Patch string `bson:"patch" json:"patch"`
PatchMinor string `bson:"patchMinor" json:"patchMinor"`
}
func (AccessLogClientOS) MarshalEasyJSON ¶ added in v0.1.8
func (v AccessLogClientOS) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AccessLogClientOS) MarshalJSON ¶
func (v AccessLogClientOS) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AccessLogClientOS) UnmarshalEasyJSON ¶ added in v0.1.8
func (v *AccessLogClientOS) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AccessLogClientOS) UnmarshalJSON ¶
func (v *AccessLogClientOS) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type AccessLogExtend ¶
type AccessLogExtend struct {
File AccessLogFile `bson:"file" json:"file"`
Client AccessLogClient `bson:"client" json:"client"`
Geo AccessLogGeo `bson:"geo" json:"geo"`
}
func (AccessLogExtend) MarshalEasyJSON ¶ added in v0.1.8
func (v AccessLogExtend) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AccessLogExtend) MarshalJSON ¶
func (v AccessLogExtend) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AccessLogExtend) UnmarshalEasyJSON ¶ added in v0.1.8
func (v *AccessLogExtend) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AccessLogExtend) UnmarshalJSON ¶
func (v *AccessLogExtend) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type AccessLogField ¶
type AccessLogField = int
type AccessLogFile ¶
type AccessLogFile struct {
MimeType string `bson:"mimeType" json:"mimeType"` // 类似于 image/jpeg
Extension string `bson:"extension" json:"extension"` // 扩展名,不带点(.)
Charset string `bson:"charset" json:"charset"` // 字符集,统一大写
}
func (AccessLogFile) MarshalEasyJSON ¶ added in v0.1.8
func (v AccessLogFile) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AccessLogFile) MarshalJSON ¶
func (v AccessLogFile) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AccessLogFile) UnmarshalEasyJSON ¶ added in v0.1.8
func (v *AccessLogFile) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AccessLogFile) UnmarshalJSON ¶
func (v *AccessLogFile) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type AccessLogGeo ¶
type AccessLogGeo struct {
Region string `bson:"region" json:"region"`
State string `bson:"state" json:"state"`
City string `bson:"city" json:"city"`
Location AccessLogGeoLocation `bson:"location" json:"location"`
}
func (AccessLogGeo) MarshalEasyJSON ¶ added in v0.1.8
func (v AccessLogGeo) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AccessLogGeo) MarshalJSON ¶
func (v AccessLogGeo) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AccessLogGeo) UnmarshalEasyJSON ¶ added in v0.1.8
func (v *AccessLogGeo) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AccessLogGeo) UnmarshalJSON ¶
func (v *AccessLogGeo) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type AccessLogGeoLocation ¶
type AccessLogGeoLocation struct {
Latitude float64 `bson:"latitude" json:"latitude"`
Longitude float64 `bson:"longitude" json:"longitude"`
TimeZone string `bson:"timeZone" json:"timeZone"`
AccuracyRadius uint16 `bson:"accuracyRadius" json:"accuracyRadius"`
MetroCode uint `bson:"metroCode" json:"metroCode"`
}
func (AccessLogGeoLocation) MarshalEasyJSON ¶ added in v0.1.8
func (v AccessLogGeoLocation) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AccessLogGeoLocation) MarshalJSON ¶
func (v AccessLogGeoLocation) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AccessLogGeoLocation) UnmarshalEasyJSON ¶ added in v0.1.8
func (v *AccessLogGeoLocation) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AccessLogGeoLocation) UnmarshalJSON ¶
func (v *AccessLogGeoLocation) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface