v0.6.14 : Add meta_back_error support
This commit is contained in:
+21
-4
@@ -47,10 +47,12 @@ const (
|
||||
AddDnRE = `(?:ADD dn="(.*)")?`
|
||||
// group[42]
|
||||
DelDnRE = `(?:DEL dn="(.*)")?`
|
||||
|
||||
// group[43], 44, 45, 46
|
||||
MetaBackOpErrorRE = `(?:meta_back_search\[([0-9]+)\] match="(.*)" err=([0-9]+) \(Operations error\) text="([^\"]*)")?`
|
||||
|
||||
LogLineRE = SyslogPri + TimeRE + ` ` + HostRE + ` ` + ProcessRE + ` ` + ConnIdRE + ` ` + ConnFdRE + OperationIdRE + ` ` +
|
||||
AcceptRE + STARTTLSRE + BindMethodRE + BindMechRE + ResultRE + SearchBaseRE + SearchAttrRE + SearchResultRE + ModDnRE + ModAttrRE +
|
||||
PassModRE + UnbindRE + ConnClosedRE + AddDnRE + DelDnRE
|
||||
PassModRE + UnbindRE + ConnClosedRE + AddDnRE + DelDnRE + MetaBackOpErrorRE
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -58,7 +60,7 @@ type (
|
||||
LogFormat LogFormat
|
||||
Regexp *regexp.Regexp
|
||||
}
|
||||
|
||||
|
||||
LogFormat struct {
|
||||
Time *time.Time `json:"time"`
|
||||
Hostname string `json:"hostname"`
|
||||
@@ -100,6 +102,10 @@ type (
|
||||
SearchResETime string `json:"search_res_etime"`
|
||||
SearchResNEntries int `json:"search_res_nentries"`
|
||||
SearchResText string `json:"search_res_text"`
|
||||
ErrorBackend int `json:"err_backend"`
|
||||
ErrorMatch string `json:"err_match"`
|
||||
ErrorErr int `json:"err_error"`
|
||||
ErrorText string `json:"err_text"`
|
||||
}
|
||||
)
|
||||
|
||||
@@ -150,7 +156,12 @@ func (o *OpenldapLog) Parse(text []byte) (LogFormat, error) {
|
||||
}
|
||||
serr,_ := strconv.Atoi(string(group[31]))
|
||||
srentries, _ := strconv.Atoi(string(group[34]))
|
||||
|
||||
|
||||
// 0 even if no error, so don't use this for error testing
|
||||
backend, _ := strconv.Atoi(string(group[43]))
|
||||
// 0 if no error, so use this instead
|
||||
backerr, _ := strconv.Atoi(string(group[45]))
|
||||
|
||||
logFormat := LogFormat{
|
||||
Time: &t,
|
||||
Hostname: string(group[2]),
|
||||
@@ -192,6 +203,10 @@ func (o *OpenldapLog) Parse(text []byte) (LogFormat, error) {
|
||||
PassModDN: string(group[38]),
|
||||
AddDN: string(group[41]),
|
||||
DelDN: string(group[42]),
|
||||
ErrorBackend: backend,
|
||||
ErrorMatch: string(group[44]),
|
||||
ErrorErr: backerr,
|
||||
ErrorText: string(group[46]),
|
||||
}
|
||||
|
||||
// Now handle Operation Type
|
||||
@@ -215,6 +230,8 @@ func (o *OpenldapLog) Parse(text []byte) (LogFormat, error) {
|
||||
logFormat.OpType = "add"
|
||||
} else if len(group[42]) > 0 {
|
||||
logFormat.OpType = "del"
|
||||
} else if logFormat.ErrorErr != 0 {
|
||||
logFormat.OpType = "error"
|
||||
}
|
||||
|
||||
return logFormat, nil
|
||||
|
||||
Reference in New Issue
Block a user