mirror of
https://github.com/Luzifer/nginx-sso.git
synced 2024-12-20 12:51:17 +00:00
Add timestamp to audit log (#31)
This commit is contained in:
parent
5d6fa23377
commit
876216ee6d
1 changed files with 2 additions and 0 deletions
2
audit.go
2
audit.go
|
@ -9,6 +9,7 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ func (a *auditLogger) Log(event auditEvent, r *http.Request, extraFields map[str
|
||||||
|
|
||||||
// Compile log event
|
// Compile log event
|
||||||
evt := map[string]interface{}{}
|
evt := map[string]interface{}{}
|
||||||
|
evt["timestamp"] = time.Now().Format(time.RFC3339)
|
||||||
evt["event_type"] = event
|
evt["event_type"] = event
|
||||||
evt["remote_addr"] = a.findIP(r)
|
evt["remote_addr"] = a.findIP(r)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue